diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-10-19 16:34:43 +0700 |
|---|---|---|
| committer | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-10-19 16:19:27 +0000 |
| commit | f92a3589fa04285dccab3ca7454eaaf2d0e7cde3 (patch) | |
| tree | d939473c2be0eb22eb9324e4dffef2fbfb12dcb1 /src/reflect/makefunc.go | |
| parent | fe7df4c4d043fc65800bbec7f575c1ba50327aa9 (diff) | |
| download | go-f92a3589fa04285dccab3ca7454eaaf2d0e7cde3.tar.xz | |
reflect: fix methodValueCall code pointer mismatched
CL 322350 changed how to take address of assembly functions, using
abi.FuncPCABI0 intrinsic. But we forgot to update the code in
Value.UnsafePointer (was Value.Pointer) to reflect that change.
This CL fixes that bug, and also add a test to make sure the code
pointer is in sync.
Change-Id: I05ae7df31c706583a0f374d8af027066528f5ceb
Reviewed-on: https://go-review.googlesource.com/c/go/+/356809
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/reflect/makefunc.go')
| -rw-r--r-- | src/reflect/makefunc.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/reflect/makefunc.go b/src/reflect/makefunc.go index 588be8bcc1..d0b0935cb8 100644 --- a/src/reflect/makefunc.go +++ b/src/reflect/makefunc.go @@ -107,7 +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))) - code := abi.FuncPCABI0(methodValueCall) + code := methodValueCallCodePtr() // methodValue contains a stack map for use by the runtime _, _, abi := funcLayout(ftyp, nil) @@ -130,6 +130,10 @@ func makeMethodValue(op string, v Value) Value { return Value{&ftyp.rtype, unsafe.Pointer(fv), v.flag&flagRO | flag(Func)} } +func methodValueCallCodePtr() uintptr { + return abi.FuncPCABI0(methodValueCall) +} + // methodValueCall is an assembly function that is the code half of // the function returned from makeMethodValue. It expects a *methodValue // as its context register, and its job is to invoke callMethod(ctxt, frame) |
