• Russ Cox's avatar
    cmd/5g, cmd/6g, cmd/8g: preserve wide values in large functions · 0a8a719d
    Russ Cox authored
    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
    0a8a719d
reg.c 28 KB