]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: do not change field offset in ABI analysis
authorCherry Mui <cherryyz@google.com>
Thu, 22 Jul 2021 16:42:09 +0000 (12:42 -0400)
committerCherry Mui <cherryyz@google.com>
Thu, 22 Jul 2021 20:47:59 +0000 (20:47 +0000)
commit052da5717e02659da49707873b3868fe36f2aaf0
treeca813f7dd624a9349ee1d273327ae9a528205a42
parent798ec73519a7226d6d436e42498a54aed23b8468
cmd/compile: do not change field offset in ABI analysis

Currently, the ABI analysis assigns parameter/result offsets
to the fields of function *Type. In some cases, we may have
an ABI0 function reference and an ABIInternal reference share
the same function *Type. For example, for an ABI0 function F,
"f := F" will make f and (ABI0) F having the same *Type. But f,
as a func value, should use ABIInternal. Analyses on F and f will
collide and cause ICE.

Also, changing field offsets in ABI analysis has to be done very
carefully to avoid data races. It has been causing
trickiness/difficulty.

This CL removes the change of field offsets in ABI analysis
altogether. The analysis result is stored in ABIParamAssignment,
which is the only way to access parameter/result stack offset now.

Fixes #47317.
Fixes #47227.

Change-Id: I23a3e081a6cf327ac66855da222daaa636ed1ead
Reviewed-on: https://go-review.googlesource.com/c/go/+/336629
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/abi/abiutils.go
src/cmd/compile/internal/ssagen/ssa.go
test/fixedbugs/issue47317.dir/a.s [new file with mode: 0644]
test/fixedbugs/issue47317.dir/x.go [new file with mode: 0644]
test/fixedbugs/issue47317.go [new file with mode: 0644]