]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: adapt GOSSAHASH to set a DebugTest flag in ssa.Config
authorDavid Chase <drchase@google.com>
Thu, 15 Sep 2016 20:51:35 +0000 (16:51 -0400)
committerDavid Chase <drchase@google.com>
Thu, 15 Sep 2016 21:49:49 +0000 (21:49 +0000)
Binary search remains our friend.
Suppose you add an ought-to-be-benign pattern to PPC64.rules,
and make.bash starts crashing.  You can guard the pattern(s)
with config.DebugTest:

(Eq8 x y) && config.DebugTest && isSigned(x.Type) &&
   isSigned(y.Type) ->
   (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y)))

and then

  gossahash -s ./make.bash
  ...
  (go drink beer while silicon minions toil)
  ...
  Trying ./make.bash args=[], env=[GOSSAHASH=100110010111110]
  ./make.bash failed (1 distinct triggers): exit status 1
  Trigger string is 'GOSSAHASH triggered (*importReader).readByte',
    repeated 1 times
  Review GSHS_LAST_FAIL.0.log for failing run
  Finished with GOSSAHASH=100110010111110

Change-Id: I4eff46ebaf496baa2acedd32e217005cb3ac1c62
Reviewed-on: https://go-review.googlesource.com/29273
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/config.go

index 9b67fe99ad5502d80a15b42c3a768ea0fced230c..6d727a5f6e10964858b5ef0b4bacde1adac265dc 100644 (file)
@@ -65,6 +65,7 @@ func buildssa(fn *Node) *ssa.Func {
        s.f.Name = name
        s.exitCode = fn.Func.Exit
        s.panics = map[funcLine]*ssa.Block{}
+       s.config.DebugTest = s.config.DebugHashMatch("GOSSAHASH", name)
 
        if name == os.Getenv("GOSSAFUNC") {
                // TODO: tempfile? it is handy to have the location
index 6c891a55db5ab904c8c4c2a0fcc4e99011c5704d..bd59bb36aba2b320a0b3fcffa70bc56fe1c4ce21 100644 (file)
@@ -33,6 +33,7 @@ type Config struct {
        nacl            bool                       // GOOS=nacl
        use387          bool                       // GO386=387
        NeedsFpScratch  bool                       // No direct move between GP and FP register sets
+       DebugTest       bool                       // as a debugging aid for binary search using GOSSAHASH, make buggy new code conditional on this
        sparsePhiCutoff uint64                     // Sparse phi location algorithm used above this #blocks*#variables score
        curFunc         *Func