aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/export_test.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2017-02-02 11:53:41 -0500
committerDavid Chase <drchase@google.com>2017-03-08 18:52:12 +0000
commitd71f36b5aa1eadc6cd86ada2c0d5dd621bd9fd82 (patch)
tree8ea9c296ba061883a35534a4b3df3162cce9785a /src/cmd/compile/internal/ssa/export_test.go
parent6fbedc1afead2de1fd554e72f6df47a4b7948b5a (diff)
downloadgo-d71f36b5aa1eadc6cd86ada2c0d5dd621bd9fd82.tar.gz
go-d71f36b5aa1eadc6cd86ada2c0d5dd621bd9fd82.zip
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>
Diffstat (limited to 'src/cmd/compile/internal/ssa/export_test.go')
-rw-r--r--src/cmd/compile/internal/ssa/export_test.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go
index ce2933d4e9..74bb08d5c2 100644
--- a/src/cmd/compile/internal/ssa/export_test.go
+++ b/src/cmd/compile/internal/ssa/export_test.go
@@ -32,11 +32,24 @@ type DummyFrontend struct {
t testing.TB
}
+type DummyAuto struct {
+ t Type
+ s string
+}
+
+func (d *DummyAuto) Typ() Type {
+ return d.t
+}
+
+func (d *DummyAuto) String() string {
+ return d.s
+}
+
func (DummyFrontend) StringData(s string) interface{} {
return nil
}
func (DummyFrontend) Auto(t Type) GCNode {
- return nil
+ return &DummyAuto{t: t, s: "aDummyAuto"}
}
func (d DummyFrontend) SplitString(s LocalSlot) (LocalSlot, LocalSlot) {
return LocalSlot{s.N, d.TypeBytePtr(), s.Off}, LocalSlot{s.N, d.TypeInt(), s.Off + 8}