1. 25 Mar, 2016 20 commits
    • Mohit Agarwal's avatar
      cmd/go: stat the archive file only when executing the commands · edb19aa1
      Mohit Agarwal authored
      Fixes #14944
      
      Change-Id: I73e0997cb6ebaeced1045b0ddadac893319bd78f
      Reviewed-on: https://go-review.googlesource.com/21065Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      edb19aa1
    • David Crawshaw's avatar
      reflect: name interface type that pins method info · 8cb74e1d
      David Crawshaw authored
      I recently added TestUnexportedMethods which uses an interface type
      to pin type information for an unexported method. But as written,
      the interface type is not accessible to the reflect package.
      
      You can imagine a future compiler optimization realizing that and
      removing the type information for f. In fact, cl/20901 happens to
      do that.
      
      Change-Id: I1ddb67f50cb9b5737253b58f10545f3de652c29d
      Reviewed-on: https://go-review.googlesource.com/21112Reviewed-by: 's avatarMichel Lespinasse <walken@google.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8cb74e1d
    • Marvin Stenger's avatar
      runtime: speed up growslice by avoiding divisions 2 · 6b0688f7
      Marvin Stenger authored
      This is a follow-up of https://go-review.googlesource.com/#/c/20653/
      
      Special case computation for slices with elements of byte size or
      pointer size.
      
      name                      old time/op  new time/op  delta
      GrowSliceBytes-4          86.2ns ± 3%  75.4ns ± 2%  -12.50%  (p=0.000 n=20+20)
      GrowSliceInts-4            161ns ± 3%   136ns ± 3%  -15.59%  (p=0.000 n=19+19)
      GrowSlicePtr-4             239ns ± 2%   233ns ± 2%   -2.52%  (p=0.000 n=20+20)
      GrowSliceStruct24Bytes-4   258ns ± 3%   256ns ± 3%     ~     (p=0.134 n=20+20)
      
      Change-Id: Ice5fa648058fe9d7fa89dee97ca359966f671128
      Reviewed-on: https://go-review.googlesource.com/21101Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6b0688f7
    • Elias Naur's avatar
      misc/ios: fix exec wrapper locking · 1664ff96
      Elias Naur authored
      The exec wrapper lock file was opened, locked and then never used
      again, assuming it would close and unlock at process exit.
      However, the garbage collector could collect and run the *os.File
      finalizer that closes the file prematurely, rendering the lock
      ineffective.
      
      Make the lock global so that the lock is live during the entire
      execution.
      
      (Hopefully) fix the iOS builders.
      
      Change-Id: I62429e92042a0a49c4f1ea553fdb32b6ea53a43e
      Reviewed-on: https://go-review.googlesource.com/21137Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      1664ff96
    • David Crawshaw's avatar
      cmd/compile: avoid pointers in go.string.* symbols · 4d920410
      David Crawshaw authored
      When creating binaries for dynamic linking, the linker moves
      read-only data symbols that contain pointers into relro sections.
      It is not setup for handling a go.string symbol moving to relro.
      
      Instead of teaching it how (because go.string symbols with pointers
      are unusual anyhow), put the data in a type.. section.
      
      Fixes the android builder.
      
      Change-Id: Ica4722d32241643c060923517b90276ff8ac6b07
      Reviewed-on: https://go-review.googlesource.com/21110Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      4d920410
    • Josh Bleecher Snyder's avatar
      cmd/compile/ssa: generate less garbage in schedule · 41e176fb
      Josh Bleecher Snyder authored
      Passes toolstash -cmp.
      
      name       old alloc/op    new alloc/op    delta
      Template      58.5MB ± 0%     57.8MB ± 0%  -1.15%        (p=0.000 n=10+10)
      Unicode       41.3MB ± 0%     41.2MB ± 0%  -0.17%        (p=0.000 n=10+10)
      GoTypes        196MB ± 0%      193MB ± 0%  -1.26%        (p=0.000 n=10+10)
      Compiler       863MB ± 0%      850MB ± 0%  -1.49%        (p=0.000 n=10+10)
      
      name       old allocs/op   new allocs/op   delta
      Template        522k ± 0%       507k ± 0%  -2.99%        (p=0.000 n=10+10)
      Unicode         403k ± 0%       401k ± 0%  -0.42%        (p=0.000 n=10+10)
      GoTypes        1.58M ± 0%      1.52M ± 0%  -3.61%        (p=0.000 n=10+10)
      Compiler       6.47M ± 0%      6.17M ± 0%  -4.62%        (p=0.000 n=10+10)
      
      Change-Id: Ia7a6242e8d226b41966c344d253814dcce6424a8
      Reviewed-on: https://go-review.googlesource.com/21141
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      41e176fb
    • Richard Miller's avatar
      runtime: avoid fork/exit race in plan9 · 967b9940
      Richard Miller authored
      There's a race between runtime.goexitsall killing all OS processes
      of a go program in order to exit, and runtime.newosproc forking a
      new one.  If the new process has been created but not yet stored
      its pid in m.procid, it will not be killed by goexitsall and
      deadlock results.
      
      This CL prevents the race by making the newly forked process
      check whether the program is exiting.  It also prevents a
      potential "shoot-out" if multiple goroutines call Exit at
      the same time, which could possibly lead to two processes
      killing each other and leaving the rest deadlocked.
      
      Change-Id: I3170b4a62d2461f6b029b3d6aad70373714ed53e
      Reviewed-on: https://go-review.googlesource.com/21135
      Run-TryBot: David du Colombier <0intro@gmail.com>
      Reviewed-by: 's avatarMarvin Stenger <marvin.stenger94@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid du Colombier <0intro@gmail.com>
      967b9940
    • Dmitry Vyukov's avatar
      runtime: improve randomized stealing logic · ea0386f8
      Dmitry Vyukov authored
      During random stealing we steal 4*GOMAXPROCS times from random procs.
      One would expect that most of the time we check all procs this way,
      but due to low quality PRNG we actually miss procs with frightening
      probability. Below are modelling experiment results for 1e6 tries:
      
      GOMAXPROCS = 2 : missed 1 procs 7944 times
      
      GOMAXPROCS = 3 : missed 1 procs 101620 times
      GOMAXPROCS = 3 : missed 2 procs 3571 times
      
      GOMAXPROCS = 4 : missed 1 procs 63916 times
      GOMAXPROCS = 4 : missed 2 procs 61 times
      GOMAXPROCS = 4 : missed 3 procs 16 times
      
      GOMAXPROCS = 5 : missed 1 procs 133136 times
      GOMAXPROCS = 5 : missed 2 procs 1025 times
      GOMAXPROCS = 5 : missed 3 procs 101 times
      GOMAXPROCS = 5 : missed 4 procs 15 times
      
      GOMAXPROCS = 8 : missed 1 procs 151765 times
      GOMAXPROCS = 8 : missed 2 procs 5057 times
      GOMAXPROCS = 8 : missed 3 procs 1726 times
      GOMAXPROCS = 8 : missed 4 procs 68 times
      
      GOMAXPROCS = 12 : missed 1 procs 199081 times
      GOMAXPROCS = 12 : missed 2 procs 27489 times
      GOMAXPROCS = 12 : missed 3 procs 3113 times
      GOMAXPROCS = 12 : missed 4 procs 233 times
      GOMAXPROCS = 12 : missed 5 procs 9 times
      
      GOMAXPROCS = 16 : missed 1 procs 237477 times
      GOMAXPROCS = 16 : missed 2 procs 30037 times
      GOMAXPROCS = 16 : missed 3 procs 9466 times
      GOMAXPROCS = 16 : missed 4 procs 1334 times
      GOMAXPROCS = 16 : missed 5 procs 192 times
      GOMAXPROCS = 16 : missed 6 procs 5 times
      GOMAXPROCS = 16 : missed 7 procs 1 times
      GOMAXPROCS = 16 : missed 8 procs 1 times
      
      A missed proc won't lead to underutilization because we check all procs
      again after dropping P. But it can lead to an unpleasant situation
      when we miss a proc, drop P, check all procs, discover work, acquire P,
      miss the proc again, repeat.
      
      Improve stealing logic to cover all procs.
      Also don't enter spinning mode and try to steal when there is nobody around.
      
      Change-Id: Ibb6b122cc7fb836991bad7d0639b77c807aab4c2
      Reviewed-on: https://go-review.googlesource.com/20836Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      Reviewed-by: 's avatarMarvin Stenger <marvin.stenger94@gmail.com>
      ea0386f8
    • Elias Naur's avatar
      compress/gzip: skip mtime test when GOROOT doesn't exist · 44189299
      Elias Naur authored
      Fixes the iOS builders
      
      Change-Id: I5097ca19048381ffb5a4c5ea038b7c4aa18ee4b7
      Reviewed-on: https://go-review.googlesource.com/21132Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      44189299
    • Marcel van Lohuizen's avatar
      cmd/go: remove double space in template · 4e31221b
      Marcel van Lohuizen authored
      Change-Id: I6113145baa727b9fd103765f74dc5d7af86dfdf8
      Reviewed-on: https://go-review.googlesource.com/21131
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      4e31221b
    • Marcel van Lohuizen's avatar
      testing: probe with N=1 · 31e5d835
      Marcel van Lohuizen authored
      Change control flow to probe with N=1. This calls benchFunc
      the same number of times as the old implementation in the
      absence of subbenchmarks.
      
      To be compatible with existing tools, benchmarking only
      prints a line for "leaf" benchmarks. This means, though, that
      the name of a benchmark can only be printed after the first
      iteration.
      
      Issue #14863
      
      Change-Id: Ic7b9b89b058f8ebb5287755f24f9e47df8c9537c
      Reviewed-on: https://go-review.googlesource.com/21043
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      31e5d835
    • Marcel van Lohuizen's avatar
      cmd/go: update alldocs.go · 2e79d7fb
      Marcel van Lohuizen authored
      Also added go:generate directive.
      
      Change-Id: Ib1f0eddc75e3c47a4d904786a29b964a35b18456
      Reviewed-on: https://go-review.googlesource.com/21042Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      2e79d7fb
    • Dominik Honnef's avatar
      all: delete dead non-test code · fdba5a75
      Dominik Honnef authored
      This change removes a lot of dead code. Some of the code has never been
      used, not even when it was first commited. The rest shouldn't have
      survived refactors.
      
      This change doesn't remove unused routines helpful for debugging, nor
      does it remove code that's used in commented out blocks of code that are
      only unused temporarily. Furthermore, unused constants weren't removed
      when they were part of a set of constants from specifications.
      
      One noteworthy omission from this CL are about 1000 lines of unused code
      in cmd/fix, 700 lines of which are the typechecker, which hasn't been
      used ever since the pre-Go 1 fixes have been removed. I wasn't sure if
      this code should stick around for future uses of cmd/fix or be culled as
      well.
      
      Change-Id: Ib714bc7e487edc11ad23ba1c3222d1fd02e4a549
      Reviewed-on: https://go-review.googlesource.com/20926Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fdba5a75
    • Dmitry Chestnykh's avatar
      crypto/hmac: simplify implementation · 6a6a0734
      Dmitry Chestnykh authored
      Store already padded keys instead of storing key and padding it during
      Reset and Sum. This simplifies code and makes Reset-Write-Sum sequences
      faster, which helps /x/crypto/pbkdf2.
      
      HMAC benchmark:
      
      benchmark                    old ns/op     new ns/op     delta
      BenchmarkHMACSHA256_1K-4     7669          7613          -0.73%
      BenchmarkHMACSHA256_32-4     1880          1737          -7.61%
      
      benchmark                    old MB/s     new MB/s     speedup
      BenchmarkHMACSHA256_1K-4     133.52       134.50       1.01x
      BenchmarkHMACSHA256_32-4     17.02        18.41        1.08x
      
      PBKDF2 benchmark:
      
      benchmark                       old ns/op     new ns/op     delta
      BenchmarkPBKDF2HMACSHA256-4     1943196       1807699       -6.97%
      
      Change-Id: I6697028370c226715ab477b0844951a83eb3488c
      Reviewed-on: https://go-review.googlesource.com/21024
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      6a6a0734
    • John Jeffery's avatar
      reflect: add method StructTag.Lookup · 5c8674a4
      John Jeffery authored
      The Lookup method provides a way to extract a tag value, while
      determining whether the tag key exists in the struct field's tag.
      
      Fixes #14883
      
      Change-Id: I7460cb68f0ca1aaa025935050b9e182efcb64db3
      Reviewed-on: https://go-review.googlesource.com/20864Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5c8674a4
    • Caleb Spare's avatar
      all: zero mtimes in testdata gz files · 139fad21
      Caleb Spare authored
      Fixes #14937.
      
      Change-Id: Iea11a32230d44d5a43f8aec812d25f13bce85895
      Reviewed-on: https://go-review.googlesource.com/21038Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      139fad21
    • Caleb Spare's avatar
      encoding/json: add (*Encoder).Indent · 098b6264
      Caleb Spare authored
      Fixes #6492.
      
      Change-Id: Ibc633c43a6d134bb140addb59780a5758b35a5c5
      Reviewed-on: https://go-review.googlesource.com/21057
      Run-TryBot: Caleb Spare <cespare@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      098b6264
    • Elias Naur's avatar
      cmd/go: remove limits on parallel tasks in the Go command for iOS · ba333a30
      Elias Naur authored
      Ther darwin/arm{,64} exec wrapper now limits the number of concurrent
      executions to 1, so remove the higher level parallel task limit from
      the Go command.
      
      Change-Id: Id84f65c3908305bde0452b3c8db6df8c5a8881bb
      Reviewed-on: https://go-review.googlesource.com/21100Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      ba333a30
    • Elias Naur's avatar
      misc/cgo/testcarchive: fix build · 95add73a
      Elias Naur authored
      I failed to rebase (and re-test) CL 21102 before submit, which meant
      that two extra tests sneaked into testcarchive that still referenced
      runtime.GOOS and runtime.GOARCH.
      
      Convert the new tests.
      
      While we're here, make sure pending tasks are flushed before running
      the host tests. If not, the "##### misc/cgo/testcarchive" banner
      and "PASS" won't show up in the all.bash output.
      
      Change-Id: I41fc4ec9515f9a193fa052f7c31fac452153c897
      Reviewed-on: https://go-review.googlesource.com/21106
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      95add73a
    • David Crawshaw's avatar
      cmd/compile, runtime: new static name encoding · 24ce64d1
      David Crawshaw authored
      Create a byte encoding designed for static Go names.
      
      It is intended to be a compact representation of a name
      and optional tag data that can be turned into a Go string
      without allocating, and describes whether or not it is
      exported without unicode table.
      
      The encoding is described in reflect/type.go:
      
      // The first byte is a bit field containing:
      //
      //	1<<0 the name is exported
      //	1<<1 tag data follows the name
      //	1<<2 pkgPath *string follow the name and tag
      //
      // The next two bytes are the data length:
      //
      //	 l := uint16(data[1])<<8 | uint16(data[2])
      //
      // Bytes [3:3+l] are the string data.
      //
      // If tag data follows then bytes 3+l and 3+l+1 are the tag length,
      // with the data following.
      //
      // If the import path follows, then ptrSize bytes at the end of
      // the data form a *string. The import path is only set for concrete
      // methods that are defined in a different package than their type.
      
      Shrinks binary sizes:
      
      	cmd/go: 164KB (1.6%)
      	jujud:  1.0MB (1.5%)
      
      For #6853.
      
      Change-Id: I46b6591015b17936a443c9efb5009de8dfe8b609
      Reviewed-on: https://go-review.googlesource.com/20968
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      24ce64d1
  2. 24 Mar, 2016 20 commits