]> Cypherpunks repositories - gostls13.git/commit
cmd/5g, cmd/6g, cmd/8g: preserve wide values in large functions
authorRuss Cox <rsc@golang.org>
Wed, 16 Apr 2014 17:59:42 +0000 (13:59 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 16 Apr 2014 17:59:42 +0000 (13:59 -0400)
commit0a8a719ded242be4d928ec77ff2169d1d9c1fa52
treedf9cd8a0469c05015a1949abff218bf408607295
parent59f6c81f98addb4fcc28810b4f4eff2990377f87
cmd/5g, cmd/6g, cmd/8g: preserve wide values in large functions

In large functions with many variables, the register optimizer
may give up and choose not to track certain variables at all.
In this case, the "nextinnode" information linking together
all the words from a given variable will be incomplete, and
the result may be that only some of a multiword value is
preserved across a call. That confuses the garbage collector,
so don't do that. Instead, mark those variables as having
their address taken, so that they will be preserved at all
calls. It's overkill, but correct.

Tested by hand using the 6g -S output to see that it does fix
the buggy generated code leading to the issue 7726 failure.

There is no automated test because I managed to break the
compiler while writing a test (see issue 7727). I will check
in a test along with the fix to issue 7727.

Fixes #7726.

LGTM=khr
R=khr, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/85200043
src/cmd/5g/reg.c
src/cmd/6g/reg.c
src/cmd/8g/reg.c