1. 06 Oct, 2012 8 commits
    • Rob Pike's avatar
      text/template: fix nil crash on Templates · bcccad40
      Rob Pike authored
      Fixes #3872.
      
      R=golang-dev, rsc
      CC=golang-dev
      https://golang.org/cl/6612060
      bcccad40
    • Rob Pike's avatar
      text/template: add an unexported method to Node · 421b75c0
      Rob Pike authored
      Protects the package a little against undesirable clients.
      
      R=golang-dev, bradfitz, rsc
      CC=golang-dev
      https://golang.org/cl/6624054
      421b75c0
    • Dave Cheney's avatar
      cmd/5g: avoid temporary during constant asop · bbccfddb
      Dave Cheney authored
      func add() int {
              var a int
              a += 10
              a += 20
              a += 30
              a -= 10
              a -= 20
              a -= 30
              return a
      }
      
      before
      
      --- prog list "add" ---
      0000 (/home/dfc/src/add.go:5) TEXT      add+0(SB),$0-4
      0001 (/home/dfc/src/add.go:6) MOVW      $0,R2
      0002 (/home/dfc/src/add.go:7) MOVW      $10,R0
      0003 (/home/dfc/src/add.go:7) ADD       R0,R2,R1
      0004 (/home/dfc/src/add.go:8) MOVW      $20,R0
      0005 (/home/dfc/src/add.go:8) ADD       R0,R1
      0006 (/home/dfc/src/add.go:9) MOVW      $30,R0
      0007 (/home/dfc/src/add.go:9) ADD       R0,R1
      0008 (/home/dfc/src/add.go:10) MOVW     $10,R0
      0009 (/home/dfc/src/add.go:10) SUB      R0,R1
      0010 (/home/dfc/src/add.go:11) MOVW     $20,R0
      0011 (/home/dfc/src/add.go:11) SUB      R0,R1
      0012 (/home/dfc/src/add.go:12) MOVW     $30,R0
      0013 (/home/dfc/src/add.go:12) SUB      R0,R1,R2
      0014 (/home/dfc/src/add.go:12) MOVW     R2,R0
      0015 (/home/dfc/src/add.go:13) MOVW     R2,R1
      0016 (/home/dfc/src/add.go:13) MOVW     R2,.noname+0(FP)
      0017 (/home/dfc/src/add.go:13) RET      ,
      
      after
      
      --- prog list "add" ---
      0000 (/home/dfc/src/add.go:5) TEXT      add+0(SB),$0-4
      0001 (/home/dfc/src/add.go:6) MOVW      $0,R0
      0002 (/home/dfc/src/add.go:7) ADD       $10,R0
      0003 (/home/dfc/src/add.go:8) ADD       $20,R0
      0004 (/home/dfc/src/add.go:9) ADD       $30,R0
      0005 (/home/dfc/src/add.go:10) SUB      $10,R0
      0006 (/home/dfc/src/add.go:11) SUB      $20,R0
      0007 (/home/dfc/src/add.go:12) SUB      $30,R0,R2
      0008 (/home/dfc/src/add.go:13) MOVW     R2,R0
      0009 (/home/dfc/src/add.go:13) MOVW     R2,.noname+0(FP)
      0010 (/home/dfc/src/add.go:13) RET      ,
      
      R=rsc, minux.ma, remyoudompheng
      CC=golang-dev
      https://golang.org/cl/6584056
      bbccfddb
    • Rémy Oudompheng's avatar
      runtime: fix a panic when growing zero-width-element slices. · 782464ae
      Rémy Oudompheng authored
      Fixes #4197.
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/6611056
      782464ae
    • Dmitriy Vyukov's avatar
      pprof: add goroutine blocking profiling · 4cc7bf32
      Dmitriy Vyukov authored
      The profiler collects goroutine blocking information similar to Google Perf Tools.
      You may see an example of the profile (converted to svg) attached to
      http://code.google.com/p/go/issues/detail?id=3946
      The public API changes are:
      +pkg runtime, func BlockProfile([]BlockProfileRecord) (int, bool)
      +pkg runtime, func SetBlockProfileRate(int)
      +pkg runtime, method (*BlockProfileRecord) Stack() []uintptr
      +pkg runtime, type BlockProfileRecord struct
      +pkg runtime, type BlockProfileRecord struct, Count int64
      +pkg runtime, type BlockProfileRecord struct, Cycles int64
      +pkg runtime, type BlockProfileRecord struct, embedded StackRecord
      
      R=rsc, dave, minux.ma, r
      CC=gobot, golang-dev, r, remyoudompheng
      https://golang.org/cl/6443115
      4cc7bf32
    • Daniel Morsing's avatar
      test: Add rundir, rundircmpout and errorcheckdir commands to testlib and run.go · ebb0e5db
      Daniel Morsing authored
      rundir will compile each file in the directory in lexicographic order, link the last file as the main package and run the resulting program. rundircmpout is an related command, that will compare the output of the program to an corresponding .out file
      
      errorcheckdir will compile each file in a directory in lexicographic order, running errorcheck on each file as it compiles. All compilations are assumed to be successful except for the last file. However, If a -0 flag is present on the command, the last compilation will also be assumed successful
      
      This CL also includes a small refactoring of run.go. It was getting unwieldy and the meaning of the run commands was hidden behind argument line formatting.
      
      Fixes #4058.
      
      R=rsc, minux.ma, remyoudompheng, iant
      CC=golang-dev
      https://golang.org/cl/6554071
      ebb0e5db
    • Jan Ziak's avatar
      cmd/cc: map C int to int32 in Go defs · 16bea49e
      Jan Ziak authored
      R=golang-dev, minux.ma, rsc
      CC=golang-dev
      https://golang.org/cl/6621052
      16bea49e
    • Dave Cheney's avatar
      cmd/5g: avoid temporary during constant OINDEX · ed0c5dd1
      Dave Cheney authored
      func addr(s[]int) *int {
      	return &s[2]
      }
      
      --- prog list "addr" ---
      0000 (/home/dfc/src/addr.go:5) TEXT     addr+0(SB),$0-16
      0001 (/home/dfc/src/addr.go:6) MOVW     $s+0(FP),R0
      0002 (/home/dfc/src/addr.go:6) MOVW     4(R0),R1
      0003 (/home/dfc/src/addr.go:6) MOVW     $2,R2
      0004 (/home/dfc/src/addr.go:6) CMP      R2,R1,
      0005 (/home/dfc/src/addr.go:6) BHI      ,7(APC)
      0006 (/home/dfc/src/addr.go:6) BL       ,runtime.panicindex+0(SB)
      0007 (/home/dfc/src/addr.go:6) MOVW     0(R0),R0
      0008 (/home/dfc/src/addr.go:6) MOVW     $8,R1
      0009 (/home/dfc/src/addr.go:6) ADD      R1,R0
      0010 (/home/dfc/src/addr.go:6) MOVW     R0,.noname+12(FP)
      0011 (/home/dfc/src/addr.go:6) RET      ,
      
      becomes
      
      --- prog list "addr" ---
      0000 (/home/dfc/src/addr.go:5) TEXT     addr+0(SB),$0-16
      0001 (/home/dfc/src/addr.go:6) MOVW     $s+0(FP),R0
      0002 (/home/dfc/src/addr.go:6) MOVW     4(R0),R1
      0003 (/home/dfc/src/addr.go:6) MOVW     $2,R2
      0004 (/home/dfc/src/addr.go:6) CMP      R2,R1,
      0005 (/home/dfc/src/addr.go:6) BHI      ,7(APC)
      0006 (/home/dfc/src/addr.go:6) BL       ,runtime.panicindex+0(SB)
      0007 (/home/dfc/src/addr.go:6) MOVW     0(R0),R0
      0008 (/home/dfc/src/addr.go:6) ADD      $8,R0
      0009 (/home/dfc/src/addr.go:6) MOVW     R0,.noname+12(FP)
      0010 (/home/dfc/src/addr.go:6) RET      ,
      
      R=rsc, remyoudompheng, minux.ma
      CC=golang-dev
      https://golang.org/cl/6590056
      ed0c5dd1
  2. 05 Oct, 2012 8 commits
  3. 04 Oct, 2012 8 commits
  4. 03 Oct, 2012 9 commits
  5. 02 Oct, 2012 4 commits
    • Robert Griesemer's avatar
      go/parser: correctly parse <-chan T(x) as <-(chan T)(x) · 05dc3bf5
      Robert Griesemer authored
      Fixes #4110.
      
      R=iant
      CC=golang-dev
      https://golang.org/cl/6597069
      05dc3bf5
    • Robert Hencke's avatar
      codereview.py: suggest installing Mercurial from official website · 10ea3254
      Robert Hencke authored
      Continuation of https://golang.org/cl/6499053/
      
      R=golang-dev, minux.ma
      CC=golang-dev
      https://golang.org/cl/6584059
      10ea3254
    • Rémy Oudompheng's avatar
      cmd/8g: do not take the address of string/slice for &s[i] · 2de064b6
      Rémy Oudompheng authored
      A similar change was made in 6g recently.
      
      LEALs in cmd/go: 31440 before, 27867 after.
      
      benchmark                 old ns/op    new ns/op    delta
      BenchmarkBinaryTree17    7065794000   6723617000   -4.84%
      BenchmarkFannkuch11      7767395000   7477945000   -3.73%
      BenchmarkGobDecode         34708140     34857820   +0.43%
      BenchmarkGobEncode         10998780     10960060   -0.35%
      BenchmarkGzip            1603630000   1471052000   -8.27%
      BenchmarkGunzip           242573900    240650400   -0.79%
      BenchmarkJSONEncode       120842200    117966100   -2.38%
      BenchmarkJSONDecode       247254900    249103100   +0.75%
      BenchmarkMandelbrot200     29237330     29241790   +0.02%
      BenchmarkParse              8111320      8096865   -0.18%
      BenchmarkRevcomp         2595780000   2694153000   +3.79%
      BenchmarkTemplate         276679600    264497000   -4.40%
      
      benchmark                              old ns/op    new ns/op    delta
      BenchmarkAppendFloatDecimal                  429          416   -3.03%
      BenchmarkAppendFloat                         780          740   -5.13%
      BenchmarkAppendFloatExp                      746          700   -6.17%
      BenchmarkAppendFloatNegExp                   752          694   -7.71%
      BenchmarkAppendFloatBig                     1228         1108   -9.77%
      BenchmarkAppendFloat32Integer                457          416   -8.97%
      BenchmarkAppendFloat32ExactFraction          662          631   -4.68%
      BenchmarkAppendFloat32Point                  771          735   -4.67%
      BenchmarkAppendFloat32Exp                    722          672   -6.93%
      BenchmarkAppendFloat32NegExp                 724          659   -8.98%
      BenchmarkAppendFloat64Fixed1                 429          400   -6.76%
      BenchmarkAppendFloat64Fixed2                 463          442   -4.54%
      
      Update #1914.
      
      R=golang-dev, daniel.morsing, rsc
      CC=golang-dev
      https://golang.org/cl/6574043
      2de064b6
    • Dmitriy Vyukov's avatar
      race: gc changes · 041fc8bf
      Dmitriy Vyukov authored
      This is the first part of a bigger change that adds data race detection feature:
      https://golang.org/cl/6456044
      This change makes gc compiler instrument memory accesses when supplied with -b flag.
      
      R=rsc, nigeltao, lvd
      CC=golang-dev
      https://golang.org/cl/6497074
      041fc8bf
  6. 01 Oct, 2012 3 commits
    • Andrew Gerrand's avatar
      cf513387
    • Dave Cheney's avatar
      cmd/5g: avoid temporary during constant binary op · 7b36acc4
      Dave Cheney authored
      This CL is an attempt to backport the abop code generation from 6g. This improves the generation of the range offset if the increment can be encoded directly via Operand2 shift encoding.
      
      0023 (/home/dfc/src/range.go:7) BGE     ,29(APC)
      0024 (/home/dfc/src/range.go:7) MOVW    0(R3),R5
      0025 (/home/dfc/src/range.go:7) MOVW    $4,R1
      0026 (/home/dfc/src/range.go:7) ADD     R1,R3,R3
      0027 (/home/dfc/src/range.go:8) ADD     R5,R4,R4
      0028 (/home/dfc/src/range.go:7) B       ,17(APC)
      
      becomes
      
      0023 (/home/dfc/src/range.go:7) BGE     ,28(APC)
      0024 (/home/dfc/src/range.go:7) MOVW    0(R3),R0
      0025 (/home/dfc/src/range.go:7) ADD     $4,R3,R3
      0026 (/home/dfc/src/range.go:8) ADD     R0,R4,R4
      0027 (/home/dfc/src/range.go:7) B       ,17(APC)
      
      Benchmarks are unimpressive
      
      dfc@qnap:~/go/test/bench/go1$ ~/go/misc/benchcmp {old,new}.txt
      benchmark                 old ns/op    new ns/op    delta
      BenchmarkBinaryTree17    2147483647   2147483647   +0.93%
      BenchmarkFannkuch11      2147483647   2147483647   -2.52%
      BenchmarkGobDecode        196135200    195842000   -0.15%
      BenchmarkGobEncode         78581650     76734450   -2.35%
      BenchmarkGzip            2147483647   2147483647   -0.47%
      BenchmarkGunzip          1087243000   1070254000   -1.56%
      BenchmarkJSONEncode      1107558000   1146077000   +3.48%
      BenchmarkJSONDecode      2147483647   2147483647   -0.07%
      BenchmarkMandelbrot200   2147483647   2147483647   -0.77%
      BenchmarkParse             74328550     71653400   -3.60%
      BenchmarkRevcomp          111123900    109325950   -1.62%
      BenchmarkTemplate        2147483647   2147483647   -0.82%
      
      benchmark                  old MB/s     new MB/s  speedup
      BenchmarkGobDecode             3.91         3.92    1.00x
      BenchmarkGobEncode             9.77        10.00    1.02x
      BenchmarkGzip                  3.65         3.66    1.00x
      BenchmarkGunzip               17.85        18.13    1.02x
      BenchmarkJSONEncode            1.75         1.69    0.97x
      BenchmarkJSONDecode            0.83         0.83    1.00x
      BenchmarkParse                 0.78         0.81    1.04x
      BenchmarkRevcomp              22.87        23.25    1.02x
      BenchmarkTemplate              0.84         0.85    1.01x
      
      R=remyoudompheng, minux.ma, rsc
      CC=golang-dev
      https://golang.org/cl/6564067
      7b36acc4
    • Jeremy Jackins's avatar
      archive/tar: fix inconsistent namespace usage in example · b9e423ef
      Jeremy Jackins authored
      This fixes some example code in the tar package documentation, which
      first refers to tar.NewWriter and then to Header, which is inconsistent
      because NewWriter and Header are both in the tar namespace.
      
      R=golang-dev, dsymonds
      CC=golang-dev
      https://golang.org/cl/6595050
      b9e423ef