]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: zero ambiguously live variables at VARKILLs
authorKeith Randall <khr@golang.org>
Wed, 19 Apr 2017 18:19:53 +0000 (11:19 -0700)
committerKeith Randall <khr@golang.org>
Thu, 20 Apr 2017 23:47:43 +0000 (23:47 +0000)
commit38dee12dea062337a9591b49a9525d85afedc09c
treef841123575aa8604a67b8a5baa0b1902600ef3f6
parent7bd1c210858f308ee9a73b6a3b953c477ebb294e
cmd/compile: zero ambiguously live variables at VARKILLs

At VARKILLs, zero a variable if it is ambiguously live.
After the VARKILL anything this variable references
might be collected. If it were to become live again later,
the GC will see references to already-collected objects.

We don't know a variable is ambiguously live until very
late in compilation (after lowering, register allocation, ...),
so it is hard to generate the code in an arch-independent way.
We also have to be careful not to clobber any registers.
Fortunately, this almost never happens so performance is ~irrelevant.

There are only 2 instances where this triggers in the stdlib.

Fixes #20029

Change-Id: Ia9585a91d7b823fad4a9d141d954464cc7af31f4
Reviewed-on: https://go-review.googlesource.com/41076
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
20 files changed:
src/cmd/compile/internal/amd64/galign.go
src/cmd/compile/internal/amd64/ggen.go
src/cmd/compile/internal/arm/galign.go
src/cmd/compile/internal/arm/ggen.go
src/cmd/compile/internal/arm64/galign.go
src/cmd/compile/internal/arm64/ggen.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/mips/galign.go
src/cmd/compile/internal/mips/ggen.go
src/cmd/compile/internal/mips64/galign.go
src/cmd/compile/internal/mips64/ggen.go
src/cmd/compile/internal/ppc64/galign.go
src/cmd/compile/internal/ppc64/ggen.go
src/cmd/compile/internal/s390x/galign.go
src/cmd/compile/internal/s390x/ggen.go
src/cmd/compile/internal/x86/galign.go
src/cmd/compile/internal/x86/ggen.go
test/fixedbugs/issue20029.go [new file with mode: 0644]