diff options
Diffstat (limited to 'libgo/go/reflect/value.go')
-rw-r--r-- | libgo/go/reflect/value.go | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index 69a8703..9901ed6 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -509,75 +509,6 @@ func isMethod(t *rtype) bool { return params > 2 } -// callReflect is the call implementation used by a function -// returned by MakeFunc. In many ways it is the opposite of the -// method Value.call above. The method above converts a call using Values -// into a call of a function with a concrete argument frame, while -// callReflect converts a call of a function with a concrete argument -// frame into a call using Values. -// It is in this file so that it can be next to the call method above. -// The remainder of the MakeFunc implementation is in makefunc.go. -func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer) { - ftyp := ctxt.typ - f := ctxt.fn - - // Copy argument frame into Values. - ptr := frame - off := uintptr(0) - in := make([]Value, 0, len(ftyp.in)) - for _, arg := range ftyp.in { - typ := arg - off += -off & uintptr(typ.align-1) - v := Value{typ, nil, flag(typ.Kind()) << flagKindShift} - if typ.size <= ptrSize { - // value fits in word. - v.val = unsafe.Pointer(loadIword(unsafe.Pointer(uintptr(ptr)+off), typ.size)) - } else { - // value does not fit in word. - // Must make a copy, because f might keep a reference to it, - // and we cannot let f keep a reference to the stack frame - // after this function returns, not even a read-only reference. - v.val = unsafe_New(typ) - memmove(v.val, unsafe.Pointer(uintptr(ptr)+off), typ.size) - v.flag |= flagIndir - } - in = append(in, v) - off += typ.size - } - - // Call underlying function. - out := f(in) - if len(out) != len(ftyp.out) { - panic("reflect: wrong return count from function created by MakeFunc") - } - - // Copy results back into argument frame. - if len(ftyp.out) > 0 { - off += -off & (ptrSize - 1) - for i, arg := range ftyp.out { - typ := arg - v := out[i] - if v.typ != typ { - panic("reflect: function created by MakeFunc using " + funcName(f) + - " returned wrong type: have " + - out[i].typ.String() + " for " + typ.String()) - } - if v.flag&flagRO != 0 { - panic("reflect: function created by MakeFunc using " + funcName(f) + - " returned value obtained from unexported field") - } - off += -off & uintptr(typ.align-1) - addr := unsafe.Pointer(uintptr(ptr) + off) - if v.flag&flagIndir == 0 { - storeIword(addr, iword(v.val), typ.size) - } else { - memmove(addr, v.val, typ.size) - } - off += typ.size - } - } -} - // methodReceiver returns information about the receiver // described by v. The Value v may or may not have the // flagMethod bit set, so the kind cached in v.flag should |