]> Cypherpunks repositories - gostls13.git/commit
reflect: handle stack-to-register translation in callMethod
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 11 Jun 2021 13:58:05 +0000 (13:58 +0000)
committerMichael Knyszek <mknyszek@google.com>
Sat, 12 Jun 2021 00:12:55 +0000 (00:12 +0000)
commit9d46ee5ac4acd6602692f70c5149a3f6db058558
tree74ab00cf909c6f544c8a1f3336a16a0ab8dc8bcb
parente552a6d31270c86064632af1d092e0db5a930250
reflect: handle stack-to-register translation in callMethod

callMethod previously assumed erroneously that between the "value" and
"method" ABIs (that is, the ABI the caller is following to call this
method value and the actual ABI of the method), it could never happen
that an argument passed on the stack in the former could be passed in
registers in the latter. The cited reason was that the latter always
uses strictly more registers.

However, there are situations where the value ABI could pass a value on
the stack, but later is passed in a register. For instance, if the
receiver pushes a value passed in registers that uses multiple registers
to be passed on the stack, later arguments which were passed on the
stack may now be passed in registers.

This change fixes callMethod to no longer makes this assumption, and
handles the stack-to-register translation explicitly.

Fixes #46696.

Change-Id: I7100a664d97bbe401302cc893b3a98b28cdcdfc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/327089
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/reflect/abi_test.go
src/reflect/value.go