From 5302cd025063e00bde7d102284f638977dde5f27 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 18 Nov 2016 00:15:38 +0000 Subject: runtime, reflect: rewrite Go to FFI type conversion in Go As we move toward the Go 1.7 garbage collector, it's essential that all allocation of values that can contain Go pointers be done using the correct type descriptor. That is simplest if we do all such allocation in Go code. This rewrites the code that converts from a Go type to a libffi CIF into Go. Reviewed-on: https://go-review.googlesource.com/33353 From-SVN: r242578 --- libgo/go/reflect/makefunc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libgo/go/reflect/makefunc.go') diff --git a/libgo/go/reflect/makefunc.go b/libgo/go/reflect/makefunc.go index 543a335..3a9fd28 100644 --- a/libgo/go/reflect/makefunc.go +++ b/libgo/go/reflect/makefunc.go @@ -63,7 +63,7 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value { method: -1, } - makeFuncFFI(ftyp, unsafe.Pointer(impl)) + makeFuncFFI(makeCIF(ftyp), unsafe.Pointer(impl)) return Value{t, unsafe.Pointer(&impl), flag(Func) | flagIndir} } @@ -102,7 +102,7 @@ func makeMethodValue(op string, v Value) Value { rcvr: rcvr, } - makeFuncFFI(ftyp, unsafe.Pointer(fv)) + makeFuncFFI(makeCIF(ftyp), unsafe.Pointer(fv)) return Value{ft, unsafe.Pointer(&fv), v.flag&flagRO | flag(Func) | flagIndir} } @@ -128,7 +128,7 @@ func makeValueMethod(v Value) Value { rcvr: v, } - makeFuncFFI(ftyp, unsafe.Pointer(impl)) + makeFuncFFI(makeCIF(ftyp), unsafe.Pointer(impl)) return Value{t, unsafe.Pointer(&impl), v.flag&flagRO | flag(Func) | flagIndir} } -- cgit v1.1