• David Chase's avatar
    cmd/compile: check loop rescheduling with stack bound, not counter · d71f36b5
    David Chase authored
    After benchmarking with a compiler modified to have better
    spill location, it became clear that this method of checking
    was actually faster on (at least) two different architectures
    (ppc64 and amd64) and it also provides more timely interruption
    of loops.
    
    This change adds a modified FOR loop node "FORUNTIL" that
    checks after executing the loop body instead of before (i.e.,
    always at least once).  This ensures that a pointer past the
    end of a slice or array is not made visible to the garbage
    collector.
    
    Without the rescheduling checks inserted, the restructured
    loop from this  change apparently provides a 1% geomean
    improvement on PPC64 running the go1 benchmarks; the
    improvement on AMD64 is only 0.12%.
    
    Inserting the rescheduling check exposed some peculiar bug
    with the ssa test code for s390x; this was updated based on
    initial code actually generated for GOARCH=s390x to use
    appropriate OpArg, OpAddr, and OpVarDef.
    
    NaCl is disabled in testing.
    
    Change-Id: Ieafaa9a61d2a583ad00968110ef3e7a441abca50
    Reviewed-on: https://go-review.googlesource.com/36206
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
    d71f36b5
syntax.go 24.1 KB