]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: check loop rescheduling with stack bound, not counter
authorDavid Chase <drchase@google.com>
Thu, 2 Feb 2017 16:53:41 +0000 (11:53 -0500)
committerDavid Chase <drchase@google.com>
Wed, 8 Mar 2017 18:52:12 +0000 (18:52 +0000)
commitd71f36b5aa1eadc6cd86ada2c0d5dd621bd9fd82
tree8ea9c296ba061883a35534a4b3df3162cce9785a
parent6fbedc1afead2de1fd554e72f6df47a4b7948b5a
cmd/compile: check loop rescheduling with stack bound, not counter

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: Cherry Zhang <cherryyz@google.com>
16 files changed:
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/fmt.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/opnames.go
src/cmd/compile/internal/gc/racewalk.go
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/loop_test.go
src/cmd/compile/internal/ssa/loopreschedchecks.go
src/runtime/proc.go
test/fixedbugs/issue10958.go
test/loopbce.go