1. 01 Feb, 2017 9 commits
    • Matthew Dempsky's avatar
      cmd/compile: simplify noding const declarations · b761b07b
      Matthew Dempsky authored
      By grouping all the logic into constDecl, we're able to get rid of the
      lastconst and lasttype globals, and simplify the logic slightly. Still
      clunky, but much easier to reason about.
      
      Change-Id: I446696c31084b3bfc1fd5d3651655a81ddd159ab
      Reviewed-on: https://go-review.googlesource.com/36023
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b761b07b
    • Josh Bleecher Snyder's avatar
      cmd/compile: insertVarPhis micro-optimization · 1cbc5aa5
      Josh Bleecher Snyder authored
      Algorithmic improvements here are hard.
      Lifting a lookup out of the loop helps a little, though.
      
      To compile the code in #17926:
      
      name  old s/op   new s/op   delta
      Real   146 ± 3%   140 ± 4%  -3.87%  (p=0.002 n=10+10)
      User   143 ± 3%   139 ± 4%  -3.08%  (p=0.005 n=10+10)
      Sys   8.28 ±35%  8.08 ±28%    ~     (p=0.684 n=10+10)
      
      Updates #17926.
      
      Change-Id: Ic255ac8b7b409c1a53791058818b7e2cf574abe3
      Reviewed-on: https://go-review.googlesource.com/33305
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      1cbc5aa5
    • Josh Bleecher Snyder's avatar
      cmd/compile: disable memory profiling when not in use · 302474c6
      Josh Bleecher Snyder authored
      The default value of runtime.MemProfileRate
      is non-zero, which means that a small portion
      of allocations go through the (slow) profiled
      allocation path.
      
      This is never useful in the compiler
      unless the -memprofile flag has been passed.
      I noticed this when samples from mprof.go
      showed up in a compiler cpu pprof listing.
      
      name       old time/op      new time/op      delta
      Template        207ms ± 4%       205ms ± 4%  -0.86%  (p=0.001 n=97+90)
      Unicode        91.8ms ± 4%      91.4ms ± 4%  -0.44%  (p=0.030 n=93+93)
      GoTypes         628ms ± 4%       624ms ± 3%  -0.73%  (p=0.001 n=95+92)
      Compiler        2.70s ± 3%       2.69s ± 3%  -0.39%  (p=0.000 n=97+95)
      Flate           131ms ± 5%       130ms ± 4%  -0.82%  (p=0.000 n=93+90)
      GoParser        154ms ± 5%       153ms ± 4%  -0.57%  (p=0.019 n=98+96)
      Reflect         394ms ± 5%       392ms ± 5%  -0.62%  (p=0.026 n=94+97)
      Tar             112ms ± 6%       112ms ± 5%    ~     (p=0.455 n=97+98)
      XML             214ms ± 3%       213ms ± 4%  -0.68%  (p=0.000 n=91+93)
      
      name       old user-ns/op   new user-ns/op   delta
      Template   246user-ms ± 3%  244user-ms ± 4%  -0.48%  (p=0.016 n=92+91)
      Unicode    114user-ms ± 5%  113user-ms ± 4%  -0.78%  (p=0.002 n=98+94)
      GoTypes    817user-ms ± 3%  813user-ms ± 2%  -0.50%  (p=0.006 n=96+94)
      Compiler   3.58user-s ± 2%  3.57user-s ± 2%  -0.38%  (p=0.003 n=97+95)
      Flate      158user-ms ± 5%  157user-ms ± 4%  -0.80%  (p=0.000 n=94+90)
      GoParser   191user-ms ± 4%  191user-ms ± 4%    ~     (p=0.122 n=98+98)
      Reflect    500user-ms ± 4%  498user-ms ± 4%    ~     (p=0.057 n=95+99)
      Tar        134user-ms ± 3%  134user-ms ± 4%    ~     (p=0.529 n=98+98)
      XML        265user-ms ± 3%  265user-ms ± 3%  -0.30%  (p=0.033 n=92+96)
      
      
      Change-Id: Ied5384e337800d567895ff8d47f15d631edf4f0b
      Reviewed-on: https://go-review.googlesource.com/35916Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      302474c6
    • Matthew Dempsky's avatar
      cmd/compile: eliminate iota_ · 9f26b9b9
      Matthew Dempsky authored
      Change-Id: Iad9c1961aedcc754ad2f6010a49f94c5a0a4bfee
      Reviewed-on: https://go-review.googlesource.com/32487
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      9f26b9b9
    • Josh Bleecher Snyder's avatar
      context: lazily initialize cancelCtx done channel · 986768de
      Josh Bleecher Snyder authored
      This CL reduces allocations when a context
      created with WithCancel either
      
      (1) never has its Done channel used or
      (2) gets cancelled before its Done channel is used
      
      This is not uncommon. Many contexts are created
      for tasks that end up not using them.
      
      name                                                old time/op    new time/op    delta
      ContextCancelTree/depth=1/Root=Background-8            112ns ± 2%      74ns ± 1%  -34.03%  (p=0.000 n=17+18)
      ContextCancelTree/depth=1/Root=OpenCanceler-8          601ns ± 3%     544ns ± 1%   -9.56%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1/Root=ClosedCanceler-8        367ns ± 4%     257ns ± 1%  -30.01%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=Background-8          2.91µs ± 2%    2.87µs ± 0%   -1.38%  (p=0.000 n=20+18)
      ContextCancelTree/depth=10/Root=OpenCanceler-8        4.36µs ± 2%    4.26µs ± 1%   -2.34%  (p=0.000 n=20+18)
      ContextCancelTree/depth=10/Root=ClosedCanceler-8      2.02µs ± 2%    1.51µs ± 1%  -25.18%  (p=0.000 n=19+19)
      ContextCancelTree/depth=100/Root=Background-8         30.5µs ± 6%    30.5µs ± 1%     ~     (p=0.941 n=20+20)
      ContextCancelTree/depth=100/Root=OpenCanceler-8       39.8µs ± 1%    41.1µs ± 1%   +3.15%  (p=0.000 n=18+19)
      ContextCancelTree/depth=100/Root=ClosedCanceler-8     17.8µs ± 1%    13.9µs ± 1%  -21.61%  (p=0.000 n=18+20)
      ContextCancelTree/depth=1000/Root=Background-8         302µs ± 1%     313µs ± 0%   +3.62%  (p=0.000 n=20+18)
      ContextCancelTree/depth=1000/Root=OpenCanceler-8       412µs ± 2%     427µs ± 1%   +3.55%  (p=0.000 n=18+19)
      ContextCancelTree/depth=1000/Root=ClosedCanceler-8     178µs ± 1%     139µs ± 1%  -21.80%  (p=0.000 n=19+17)
      
      name                                                old alloc/op   new alloc/op   delta
      ContextCancelTree/depth=1/Root=Background-8             176B ± 0%       80B ± 0%  -54.55%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1/Root=OpenCanceler-8           544B ± 0%      448B ± 0%  -17.65%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1/Root=ClosedCanceler-8         352B ± 0%      160B ± 0%  -54.55%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=Background-8          3.49kB ± 0%    3.39kB ± 0%   -2.75%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=OpenCanceler-8        3.86kB ± 0%    3.76kB ± 0%   -2.49%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=ClosedCanceler-8      1.94kB ± 0%    0.88kB ± 0%  -54.55%  (p=0.000 n=20+20)
      ContextCancelTree/depth=100/Root=Background-8         36.6kB ± 0%    36.5kB ± 0%   -0.26%  (p=0.000 n=20+20)
      ContextCancelTree/depth=100/Root=OpenCanceler-8       37.0kB ± 0%    36.9kB ± 0%   -0.26%  (p=0.000 n=20+20)
      ContextCancelTree/depth=100/Root=ClosedCanceler-8     17.8kB ± 0%     8.1kB ± 0%  -54.55%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1000/Root=Background-8         368kB ± 0%     368kB ± 0%   -0.03%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1000/Root=OpenCanceler-8       368kB ± 0%     368kB ± 0%   -0.03%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1000/Root=ClosedCanceler-8     176kB ± 0%      80kB ± 0%  -54.55%  (p=0.000 n=20+20)
      
      name                                                old allocs/op  new allocs/op  delta
      ContextCancelTree/depth=1/Root=Background-8             3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1/Root=OpenCanceler-8           8.00 ± 0%      7.00 ± 0%  -12.50%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1/Root=ClosedCanceler-8         6.00 ± 0%      4.00 ± 0%  -33.33%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=Background-8            48.0 ± 0%      47.0 ± 0%   -2.08%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=OpenCanceler-8          53.0 ± 0%      52.0 ± 0%   -1.89%  (p=0.000 n=20+20)
      ContextCancelTree/depth=10/Root=ClosedCanceler-8        33.0 ± 0%      22.0 ± 0%  -33.33%  (p=0.000 n=20+20)
      ContextCancelTree/depth=100/Root=Background-8            498 ± 0%       497 ± 0%   -0.20%  (p=0.000 n=20+20)
      ContextCancelTree/depth=100/Root=OpenCanceler-8          503 ± 0%       502 ± 0%   -0.20%  (p=0.000 n=20+20)
      ContextCancelTree/depth=100/Root=ClosedCanceler-8        303 ± 0%       202 ± 0%  -33.33%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1000/Root=Background-8         5.00k ± 0%     5.00k ± 0%   -0.02%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1000/Root=OpenCanceler-8       5.00k ± 0%     5.00k ± 0%   -0.02%  (p=0.000 n=20+20)
      ContextCancelTree/depth=1000/Root=ClosedCanceler-8     3.00k ± 0%     2.00k ± 0%  -33.33%  (p=0.000 n=20+20)
      
      Change-Id: Ibd7a0c3d5c847861cf1497f8fead34329413d26d
      Reviewed-on: https://go-review.googlesource.com/34979
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarSameer Ajmani <sameer@golang.org>
      986768de
    • Michael Munday's avatar
      cmd/asm, cmd/internal/obj/s390x: fix encoding of VREPI{H,F,G} · fd118b69
      Michael Munday authored
      Also adds tests for all missing VRI-a instructions (which may be
      affected by this change).
      
      Fixes #18749.
      
      Change-Id: I48249dda626f32555da9ab58659e2e140de6504a
      Reviewed-on: https://go-review.googlesource.com/35561
      Run-TryBot: Michael Munday <munday@ca.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      fd118b69
    • Joe Tsai's avatar
      testing: synchronize writes to the root's Writer · 7f31971f
      Joe Tsai authored
      Prior to this change it was possible to see interleaved messages:
      <<<
      === RUN   Test/LongLongLongLongName48
      === RUN   Test/LongLon=== RUN   Test/LongLongLongLongName50
      gLongLongName49
      === RUN   Test/LongLongLongLongName51
      
      >
      > This change fixes it such that you see:
      > <<<
      > === RUN   Test/LongLongLongLongName48
      > === RUN   Test/LongLongLongLongName49
      > === RUN   Test/LongLongLongLongName50
      > === RUN   Test/LongLongLongLongName51
      
      
      Fixes #18741
      
      Change-Id: I2529d724065dc65b3e9eb3d7cbeeda82a2d0cfd4
      Reviewed-on: https://go-review.googlesource.com/35556Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      7f31971f
    • Joe Tsai's avatar
      reflect: adjust documentation on Value · 048b8cec
      Joe Tsai authored
      Make the documentation more explicit that it is not safe to directly
      compare Value. Get straight to the point on how to do it correctly.
      
      Updates #18871
      
      Change-Id: I2aa3253f779636b2f72a1aae8c9bb45d3c32c902
      Reviewed-on: https://go-review.googlesource.com/36018Reviewed-by: default avatarKeith Randall <khr@golang.org>
      048b8cec
    • Russ Cox's avatar
      all: merge dev.inline into master · 47ce8787
      Russ Cox authored
      Change-Id: I7715581a04e513dcda9918e853fa6b1ddc703770
      47ce8787
  2. 31 Jan, 2017 3 commits
    • Russ Cox's avatar
      all: merge dev.typealias into master · c47df7ae
      Russ Cox authored
      For #18130.
      
      f8b41236 [dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'
      9ecc3ee2 [dev.typealias] cmd/compile: avoid false positive cycles from type aliases
      49b7af8a [dev.typealias] reflect: add test for type aliases
      9bbb07dd [dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
      43c70943 [dev.typealias] reflect: fix StructOf use of StructField to match StructField docs
      9657e0b0 [dev.typealias] cmd/doc: update for type alias
      de2e5459 [dev.typealias] cmd/compile: declare methods after resolving receiver type
      9259f307 [dev.typealias] test: match gccgo error messages on alias2.go
      5d929167 [dev.typealias] cmd/compile: change Func.Shortname to *Sym
      a7c884ef [dev.typealias] go/internal/gccgoimporter: support for type aliases
      5802cfd9 [dev.typealias] cmd/compile: export/import test cases for type aliases
      d7cabd40 [dev.typealias] go/types: clarified doc string
      cc2dcce3 [dev.typealias] cmd/compile: a few better comments related to alias types
      5c160b28 [dev.typealias] cmd/compile: improved error message for cyles involving type aliases
      b2386dff [dev.typealias] cmd/compile: type-check type alias declarations
      ac8421f9 [dev.typealias] cmd/compile: various minor cleanups
      f011e0c6 [dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes
      49de5f03 [dev.typealias] cmd/compile, go/importer: define export format and implement importing of type aliases
      5ceec42d [dev.typealias] go/types: export TypeName.IsAlias so clients can use it
      aa1f0681 [dev.typealias] go/types: improved Object printing
      c80748e3 [dev.typealias] go/types: remove some more vestiges of prior alias implementation
      80d8b69e [dev.typealias] go/types: implement type aliases
      a917097b [dev.typealias] go/build: add go1.9 build tag
      3e119404 [dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet supported)
      e0a05c27 [dev.typealias] cmd/gofmt: added test cases for alias type declarations
      2e5116bd [dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support
      
      Change-Id: Ia65f2e011fd7195f18e1dce67d4d49b80a261203
      c47df7ae
    • Alberto Donizetti's avatar
      testing: stop timeout-timer after running tests · 7d8bfdde
      Alberto Donizetti authored
      Fixes #18845
      
      Change-Id: Icdc3e2067807781e42f2ffc94d1824aed94d3713
      Reviewed-on: https://go-review.googlesource.com/35956
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      7d8bfdde
    • Robert Griesemer's avatar
      [dev.typealias] spec: use term 'embedded field' rather than 'anonymous field' · f8b41236
      Robert Griesemer authored
      First steps towards defining type aliases in the spec.
      This is a nomenclature clarification, not a language change.
      
      The spec used all three terms 'embedded type', 'anonymous field',
      and 'embedded field'. Users where using the terms inconsistently.
      
      The notion of an 'anonymous' field was always misleading since they
      always had a de-facto name. With type aliases that name becomes even
      more important because we may have different names for the same type.
      
      Use the term 'embedded field' consistently and remove competing
      terminology.
      
      For #18130.
      
      Change-Id: I2083bbc85788cab0b2e2cb1ff58b2f979491f001
      Reviewed-on: https://go-review.googlesource.com/35108Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      f8b41236
  3. 30 Jan, 2017 2 commits
  4. 29 Jan, 2017 2 commits
  5. 28 Jan, 2017 1 commit
  6. 27 Jan, 2017 1 commit
  7. 26 Jan, 2017 5 commits
  8. 25 Jan, 2017 7 commits
  9. 24 Jan, 2017 9 commits
  10. 23 Jan, 2017 1 commit
    • Keith Randall's avatar
      runtime: amd64, use 4-byte ops for memmove of 4 bytes · a96e117a
      Keith Randall authored
      memmove used to use 2 2-byte load/store pairs to move 4 bytes.
      When the result is loaded with a single 4-byte load, it caused
      a store to load fowarding stall.  To avoid the stall,
      special case memmove to use 4 byte ops for the 4 byte copy case.
      
      We already have a special case for 8-byte copies.
      386 already specializes 4-byte copies.
      I'll do 2-byte copies also, but not for 1.8.
      
      benchmark                 old ns/op     new ns/op     delta
      BenchmarkIssue18740-8     7567          4799          -36.58%
      
      3-byte copies get a bit slower.  Other copies are unchanged.
      name         old time/op   new time/op   delta
      Memmove/3-8   4.76ns ± 5%   5.26ns ± 3%  +10.50%  (p=0.000 n=10+10)
      
      Fixes #18740
      
      Change-Id: Iec82cbac0ecfee80fa3c8fc83828f9a1819c3c74
      Reviewed-on: https://go-review.googlesource.com/35567
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      a96e117a