aboutsummaryrefslogtreecommitdiff
path: root/src/reflect/all_test.go
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-10-19 16:34:43 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-10-19 16:19:27 +0000
commitf92a3589fa04285dccab3ca7454eaaf2d0e7cde3 (patch)
treed939473c2be0eb22eb9324e4dffef2fbfb12dcb1 /src/reflect/all_test.go
parentfe7df4c4d043fc65800bbec7f575c1ba50327aa9 (diff)
downloadgo-f92a3589fa04285dccab3ca7454eaaf2d0e7cde3.tar.gz
go-f92a3589fa04285dccab3ca7454eaaf2d0e7cde3.zip
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/all_test.go')
-rw-r--r--src/reflect/all_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go
index 141cc8f73d..91aac9cccb 100644
--- a/src/reflect/all_test.go
+++ b/src/reflect/all_test.go
@@ -7722,3 +7722,11 @@ func TestNotInHeapDeref(t *testing.T) {
v = ValueOf((*nih)(unsafe.Pointer(new(int))))
shouldPanic("reflect: reflect.Value.Elem on an invalid notinheap pointer", func() { v.Elem() })
}
+
+func TestMethodCallValueCodePtr(t *testing.T) {
+ p := ValueOf(Point{}).Method(1).UnsafePointer()
+ want := MethodValueCallCodePtr()
+ if got := uintptr(p); got != want {
+ t.Errorf("methodValueCall code pointer mismatched, want: %v, got: %v", want, got)
+ }
+}