reflect: Copy stack values onto heap in amd64 MakeFunc.
From-SVN: r202995
This commit is contained in:
parent
a84dbde7fc
commit
5f18389f4d
1 changed files with 8 additions and 2 deletions
|
@ -431,8 +431,14 @@ argloop:
|
|||
func amd64Memarg(in []Value, ap uintptr, rt *rtype) ([]Value, uintptr) {
|
||||
ap = align(ap, ptrSize)
|
||||
ap = align(ap, uintptr(rt.align))
|
||||
p := Value{rt, unsafe.Pointer(ap), flag(rt.Kind()<<flagKindShift) | flagIndir}
|
||||
in = append(in, p)
|
||||
|
||||
// We have to copy the argument onto the heap in case the
|
||||
// function hangs onto the reflect.Value we pass it.
|
||||
p := unsafe_New(rt)
|
||||
memmove(p, unsafe.Pointer(ap), rt.size)
|
||||
|
||||
v := Value{rt, p, flag(rt.Kind()<<flagKindShift) | flagIndir}
|
||||
in = append(in, v)
|
||||
ap += rt.size
|
||||
return in, ap
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue