]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: pre-spill pointers in aggregate-typed register args
authorDavid Chase <drchase@google.com>
Tue, 6 Apr 2021 22:39:15 +0000 (18:39 -0400)
committerDavid Chase <drchase@google.com>
Wed, 7 Apr 2021 03:42:11 +0000 (03:42 +0000)
commit8462169b5a6c37e024ca5d49a823d4ce95e90e23
tree275e063afd1e3045998e7a38edc1bdf72ddc51e0
parent8d77e45064fc808460843e741c46e3b6b737ae03
cmd/compile: pre-spill pointers in aggregate-typed register args

There's a problem in liveness, where liveness of any
part of an aggregate keeps the whole aggregate alive,
but the not-live parts don't get spilled.  The GC
can observe those live-but-not-spilled slots, which
can contain junk.

A better fix is to change liveness to work
pointer-by-pointer, but that is also a riskier,
trickier fix.

To avoid this, in the case of

(1) an aggregate input parameter
(2) containing pointers
(3) passed in registers

pre-spill the pointers.

Updates #40724.

Change-Id: I6beb8e0a353b1ae3c68c16072f56698061922c04
Reviewed-on: https://go-review.googlesource.com/c/go/+/307909
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssagen/ssa.go
test/abi/part_live.go [new file with mode: 0644]
test/abi/part_live_2.go [new file with mode: 0644]