diff options
author | Matthew Dempsky <mdempsky@google.com> | 2015-10-21 10:40:39 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2015-10-21 18:37:45 +0000 |
commit | c27925094640f0d151da92663d19d511d8dfdc31 (patch) | |
tree | 9603b94dda5a2c4186f9d8b83a985da55b414065 /src/runtime/mfinal.go | |
parent | 163653eeaafad9e7ad9e1cea421f683b62e5904f (diff) | |
download | go-c27925094640f0d151da92663d19d511d8dfdc31.tar.gz go-c27925094640f0d151da92663d19d511d8dfdc31.zip |
runtime: change functype's in and out fields to []*_type
Allows removing a few gratuitous unsafe.Pointer conversions and
parallels the type of reflect.funcType's in and out fields ([]*rtype).
Change-Id: Ie5ca230a94407301a854dfd8782a3180d5054bc4
Reviewed-on: https://go-review.googlesource.com/16163
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/mfinal.go')
-rw-r--r-- | src/runtime/mfinal.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go index 7e1773c88c..a753ceda52 100644 --- a/src/runtime/mfinal.go +++ b/src/runtime/mfinal.go @@ -327,11 +327,10 @@ func SetFinalizer(obj interface{}, finalizer interface{}) { throw("runtime.SetFinalizer: second argument is " + *ftyp._string + ", not a function") } ft := (*functype)(unsafe.Pointer(ftyp)) - ins := *(*[]*_type)(unsafe.Pointer(&ft.in)) - if ft.dotdotdot || len(ins) != 1 { + if ft.dotdotdot || len(ft.in) != 1 { throw("runtime.SetFinalizer: cannot pass " + *etyp._string + " to finalizer " + *ftyp._string) } - fint := ins[0] + fint := ft.in[0] switch { case fint == etyp: // ok - same type @@ -356,7 +355,7 @@ func SetFinalizer(obj interface{}, finalizer interface{}) { okarg: // compute size needed for return parameters nret := uintptr(0) - for _, t := range *(*[]*_type)(unsafe.Pointer(&ft.out)) { + for _, t := range ft.out { nret = round(nret, uintptr(t.align)) + uintptr(t.size) } nret = round(nret, ptrSize) |