diff options
author | Cherry Mui <cherryyz@google.com> | 2021-11-11 19:58:23 -0500 |
---|---|---|
committer | Cherry Mui <cherryyz@google.com> | 2021-11-12 14:56:58 +0000 |
commit | 23adc139bf1c0c099dd075da076f5a1f3ac700d4 (patch) | |
tree | 83e02a244a5ad49eb1461ec1a5d9a6a9806a54f3 /src/internal | |
parent | e9f0381a807d1797e0b5969a29f4a3666a73c9e3 (diff) | |
download | go-23adc139bf1c0c099dd075da076f5a1f3ac700d4.tar.gz go-23adc139bf1c0c099dd075da076f5a1f3ac700d4.zip |
reflect: keep pointer in aggregate-typed args live in Call
When register ABI is used, reflect.Value.Call prepares the call
arguments in a memory representation of the argument registers.
It has special handling to keep the pointers in arguments live.
Currently, this handles pointer-typed arguments. But when an
argument is an aggregate-type that contains pointers and passed
in registers, it currently doesn't keep the pointers live. Do
so in this CL.
May fix #49363.
Change-Id: Ic6a0c5fdf9375ef02f7c03fbe9345e2e98c9353d
Reviewed-on: https://go-review.googlesource.com/c/go/+/363358
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/abi/abi.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/internal/abi/abi.go b/src/internal/abi/abi.go index 46dc593bd7..b266a7ff78 100644 --- a/src/internal/abi/abi.go +++ b/src/internal/abi/abi.go @@ -44,6 +44,24 @@ type RegArgs struct { ReturnIsPtr IntArgRegBitmap } +func (r *RegArgs) Dump() { + print("Ints:") + for _, x := range r.Ints { + print(" ", x) + } + println() + print("Floats:") + for _, x := range r.Floats { + print(" ", x) + } + println() + print("Ptrs:") + for _, x := range r.Ptrs { + print(" ", x) + } + println() +} + // IntRegArgAddr returns a pointer inside of r.Ints[reg] that is appropriately // offset for an argument of size argSize. // |