mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: fix garbage collection bug in Call.
Fixes #476. R=r CC=golang-dev https://golang.org/cl/190041
This commit is contained in:
parent
7c1bb00374
commit
da225c231f
1 changed files with 9 additions and 5 deletions
|
|
@ -829,15 +829,19 @@ func (fv *FuncValue) Call(in []Value) []Value {
|
||||||
if size < 8 {
|
if size < 8 {
|
||||||
size = 8
|
size = 8
|
||||||
}
|
}
|
||||||
args := make([]byte, size)
|
|
||||||
ptr := uintptr(unsafe.Pointer(&args[0]))
|
// round to pointer size
|
||||||
|
size = (size + ptrSize - 1) &^ (ptrSize - 1)
|
||||||
|
|
||||||
// Copy into args.
|
// Copy into args.
|
||||||
//
|
//
|
||||||
// TODO(rsc): revisit when reference counting happens.
|
// TODO(rsc): revisit when reference counting happens.
|
||||||
// This one may be fine. The values are holding up the
|
// The values are holding up the in references for us,
|
||||||
// references for us, so maybe this can be treated
|
// but something must be done for the out references.
|
||||||
// like any stack-to-stack copy.
|
// For now make everything look like a pointer by pretending
|
||||||
|
// to allocate a []*int.
|
||||||
|
args := make([]*int, size/ptrSize)
|
||||||
|
ptr := uintptr(unsafe.Pointer(&args[0]))
|
||||||
off := uintptr(0)
|
off := uintptr(0)
|
||||||
delta := 0
|
delta := 0
|
||||||
if v := fv.first; v != nil {
|
if v := fv.first; v != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue