1. 05 May, 2016 9 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: optimize lookupVarOutgoing · bc1989f1
      Josh Bleecher Snyder authored
      If b has exactly one predecessor, as happens
      frequently with static calls, we can make
      lookupVarOutgoing generate less garbage.
      
      Instead of generating a value that is just
      going to be an OpCopy and then get eliminated,
      loop. This can lead to lots of looping.
      However, this loop is way cheaper than generating
      lots of ssa.Values and then eliminating them.
      
      For a subset of the code in #15537:
      
      Before:
      
             28.31 real        36.17 user         1.68 sys
      2282450944  maximum resident set size
      
      After:
      
              9.63 real        11.66 user         0.51 sys
       638144512  maximum resident set size
      
      Updates #15537.
      
      Excitingly, it appears that this also helps
      regular code:
      
      name       old time/op      new time/op      delta
      Template        288ms ± 6%       276ms ± 7%   -4.13%        (p=0.000 n=21+24)
      Unicode         143ms ± 8%       141ms ±10%     ~           (p=0.287 n=24+25)
      GoTypes         932ms ± 4%       874ms ± 4%   -6.20%        (p=0.000 n=23+22)
      Compiler        4.89s ± 4%       4.58s ± 4%   -6.46%        (p=0.000 n=22+23)
      MakeBash        40.2s ±13%       39.8s ± 9%     ~           (p=0.648 n=23+23)
      
      name       old user-ns/op   new user-ns/op   delta
      Template   388user-ms ±10%  373user-ms ± 5%   -3.80%        (p=0.000 n=24+25)
      Unicode    203user-ms ± 6%  202user-ms ± 7%     ~           (p=0.492 n=22+24)
      GoTypes    1.29user-s ± 4%  1.17user-s ± 4%   -9.67%        (p=0.000 n=25+23)
      Compiler   6.86user-s ± 5%  6.28user-s ± 4%   -8.49%        (p=0.000 n=25+25)
      
      name       old alloc/op     new alloc/op     delta
      Template       51.5MB ± 0%      47.6MB ± 0%   -7.47%        (p=0.000 n=22+25)
      Unicode        37.2MB ± 0%      37.1MB ± 0%   -0.21%        (p=0.000 n=25+25)
      GoTypes         166MB ± 0%       138MB ± 0%  -16.83%        (p=0.000 n=25+25)
      Compiler        756MB ± 0%       628MB ± 0%  -16.96%        (p=0.000 n=25+23)
      
      name       old allocs/op    new allocs/op    delta
      Template         450k ± 0%        445k ± 0%   -1.02%        (p=0.000 n=25+25)
      Unicode          356k ± 0%        356k ± 0%     ~           (p=0.374 n=24+25)
      GoTypes         1.31M ± 0%       1.25M ± 0%   -4.18%        (p=0.000 n=25+25)
      Compiler        5.29M ± 0%       5.02M ± 0%   -5.15%        (p=0.000 n=25+23)
      
      It also seems to help in other cases in which
      phi insertion is a pain point (#14774, #14934).
      
      Change-Id: Ibd05ed7b99d262117ece7bb250dfa8c3d1cc5dd2
      Reviewed-on: https://go-review.googlesource.com/22790Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      bc1989f1
    • Cherry Zhang's avatar
      cmd/compile/internal/gc: skip TestFP on mips64x · 6ccab441
      Cherry Zhang authored
      The legacy mips64 backend doesn't handle large uint->float conversion
      correctly. See #15552.
      
      Change-Id: I84ceeaa95cc4e85f09cc46dfb30ab5d151f6b205
      Reviewed-on: https://go-review.googlesource.com/22800Reviewed-by: default avatarMinux Ma <minux@golang.org>
      6ccab441
    • Cherry Zhang's avatar
      cmd/compile/internal/gc: remove duplicated TestFP · bfa89c3c
      Cherry Zhang authored
      TestFp and TestFP are same, remove one.
      
      Change-Id: Iffdece634cd4572421974496298925e7c6ac13a9
      Reviewed-on: https://go-review.googlesource.com/22799Reviewed-by: default avatarMinux Ma <minux@golang.org>
      Run-TryBot: Minux Ma <minux@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bfa89c3c
    • Keith Randall's avatar
      cmd/compile: enable constant-time CFG editing · 4fa05002
      Keith Randall authored
      Provide indexes along with block pointers for Preds
      and Succs arrays.  This allows us to splice edges in
      and out of those arrays in constant time.
      
      Fixes worst-case O(n^2) behavior in deadcode and fuse.
      
      benchmark                     old ns/op      new ns/op     delta
      BenchmarkFuse1-8              2065           2057          -0.39%
      BenchmarkFuse10-8             9408           9073          -3.56%
      BenchmarkFuse100-8            105238         76277         -27.52%
      BenchmarkFuse1000-8           3982562        1026750       -74.22%
      BenchmarkFuse10000-8          301220329      12824005      -95.74%
      BenchmarkDeadCode1-8          1588           1566          -1.39%
      BenchmarkDeadCode10-8         4333           4250          -1.92%
      BenchmarkDeadCode100-8        32031          32574         +1.70%
      BenchmarkDeadCode1000-8       590407         468275        -20.69%
      BenchmarkDeadCode10000-8      17822890       5000818       -71.94%
      BenchmarkDeadCode100000-8     1388706640     78021127      -94.38%
      BenchmarkDeadCode200000-8     5372518479     168598762     -96.86%
      
      Change-Id: Iccabdbb9343fd1c921ba07bbf673330a1c36ee17
      Reviewed-on: https://go-review.googlesource.com/22589Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4fa05002
    • Cherry Zhang's avatar
      runtime: skip TestCgoCallbackGC on linux/mips64x · bcd4b84b
      Cherry Zhang authored
      Builder is too slow. This test passed on builder machines but took
      15+ min.
      
      Change-Id: Ief9d67ea47671a57e954e402751043bc1ce09451
      Reviewed-on: https://go-review.googlesource.com/22798Reviewed-by: default avatarMinux Ma <minux@golang.org>
      Run-TryBot: Minux Ma <minux@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bcd4b84b
    • Cherry Zhang's avatar
      cmd/link: fix external linker argument for mips64 · 3c4ebd20
      Cherry Zhang authored
      I overlooked it when rebasing CL 19803.
      
      Change-Id: Ife9d6bcc6a772715d137af903c64bafac0cdb216
      Reviewed-on: https://go-review.googlesource.com/22797Reviewed-by: default avatarMinux Ma <minux@golang.org>
      3c4ebd20
    • Ian Lance Taylor's avatar
      runtime: put tracebackctxt C functions in .c file · 34f97d28
      Ian Lance Taylor authored
      Since tracebackctxt.go uses //export functions, the C functions can't be
      externally visible in the C comment. The code was using attributes to
      work around that, but that failed on Windows.
      
      Change-Id: If4449fd8209a8998b4f6855ea89e5db1471b2981
      Reviewed-on: https://go-review.googlesource.com/22786Reviewed-by: default avatarMinux Ma <minux@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      34f97d28
    • Alex Brainman's avatar
      debug/pe: unexport newly introduced identifiers · 57be1607
      Alex Brainman authored
      CLs 22181, 22332 and 22336 intorduced new functionality to be used
      in cmd/link (see issue #15345 for details). But we didn't have chance
      to use new functionality yet. Unexport newly introduced identifiers,
      so we don't have to commit to the API until we actually tried it.
      
      Rename File.COFFSymbols into File._COFFSymbols,
      COFFSymbol.FullName into COFFSymbol._FullName,
      Section.Relocs into Section._Relocs,
      Reloc into _Relocs,
      File.StringTable into File._StringTable and
      StringTable into _StringTable.
      
      Updates #15345
      
      Change-Id: I770eeb61f855de85e0c175225d5d1c006869b9ec
      Reviewed-on: https://go-review.googlesource.com/22720Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      57be1607
    • Nigel Tao's avatar
      compress/flate: distinguish between base and min match length. · 27d0d849
      Nigel Tao authored
      Change-Id: I93db5cd86e3fb568e4444cad95268ba4a02ce8a0
      Reviewed-on: https://go-review.googlesource.com/22787Reviewed-by: default avatarNigel Tao <nigeltao@golang.org>
      27d0d849
  2. 04 May, 2016 24 commits
  3. 03 May, 2016 7 commits
    • Brad Fitzpatrick's avatar
      cmd/vet: fix test's dependence on perl · 4d5ac10f
      Brad Fitzpatrick authored
      Change-Id: I774dbd4f90ef271a0969c3c8e65d145669312e3e
      Reviewed-on: https://go-review.googlesource.com/22745
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarRoss Light <light@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4d5ac10f
    • Keith Randall's avatar
      cmd/compile: never CSE two memories · b64c7fc6
      Keith Randall authored
      It never makes sense to CSE two ops that generate memory.
      We might as well start those ops off in their own partition.
      
      Fixes #15520
      
      Change-Id: I0091ed51640f2c10cd0117f290b034dde7a86721
      Reviewed-on: https://go-review.googlesource.com/22741Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b64c7fc6
    • Brad Fitzpatrick's avatar
      strings, bytes: fix Reader 0 byte read at EOF · 01182425
      Brad Fitzpatrick authored
      0 byte reads at EOF weren't returning EOF.
      
      Change-Id: I19b5fd5a72e83d49566a230ce4067be03f00d14b
      Reviewed-on: https://go-review.googlesource.com/22740Reviewed-by: default avatarBryan Mills <bcmills@google.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      01182425
    • Robert Griesemer's avatar
      cmd/compile: use correct packages when exporting/importing _ (blank) names · 15f7a66f
      Robert Griesemer authored
      1) Blank parameters cannot be accessed so the package doesn't matter.
         Do not export it, and consistently use localpkg when importing a
         blank parameter.
      
      2) More accurately replicate fmt.go and parser.go logic when importing
         a blank struct field. Blank struct fields get exported without
         package qualification.
         (This is actually incorrect, even with the old textual export format,
         but we will fix that in a separate change. See also issue 15514.)
      
      Fixes #15491.
      
      Change-Id: I7978e8de163eb9965964942aee27f13bf94a7c3c
      Reviewed-on: https://go-review.googlesource.com/22714Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      15f7a66f
    • Dmitry Vyukov's avatar
      cmd/trace: make binary argument optional · babdbfb8
      Dmitry Vyukov authored
      1.7 traces embed symbol info and we now generate symbolized pprof profiles,
      so we don't need the binary. Make binary argument optional as 1.5 traces
      still need it.
      
      Change-Id: I65eb13e3d20ec765acf85c42d42a8d7aae09854c
      Reviewed-on: https://go-review.googlesource.com/22410Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      babdbfb8
    • Dmitry Vyukov's avatar
      runtime: per-P contexts for race detector · caa21475
      Dmitry Vyukov authored
      Race runtime also needs local malloc caches and currently uses
      a mix of per-OS-thread and per-goroutine caches. This leads to
      increased memory consumption. But more importantly cache of
      synchronization objects is per-goroutine and we don't always
      have goroutine context when feeing memory in GC. As the result
      synchronization object descriptors leak (more precisely, they
      can be reused if another synchronization object is recreated
      at the same address, but it does not always help). For example,
      the added BenchmarkSyncLeak has effectively runaway memory
      consumption (based on a real long running server).
      
      This change updates race runtime with support for per-P contexts.
      BenchmarkSyncLeak now stabilizes at ~1GB memory consumption.
      
      Long term, this will allow us to remove race runtime dependency
      on glibc (as malloc is the main cornerstone).
      
      I've also implemented a different scheme to pass P context to
      race runtime: scheduler notified race runtime about association
      between G and P by calling procwire(g, p)/procunwire(g, p).
      But it turned out to be very messy as we have lots of places
      where the association changes (e.g. syscalls). So I dropped it
      in favor of the current scheme: race runtime asks scheduler
      about the current P.
      
      Fixes #14533
      
      Change-Id: Iad10d2f816a44affae1b9fed446b3580eafd8c69
      Reviewed-on: https://go-review.googlesource.com/19970Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      caa21475
    • Dmitry Vyukov's avatar
      runtime: fix CPU underutilization · fcd7c02c
      Dmitry Vyukov authored
      Runqempty is a critical predicate for scheduler. If runqempty spuriously
      returns true, then scheduler can fail to schedule arbitrary number of
      runnable goroutines on idle Ps for arbitrary long time. With the addition
      of runnext runqempty predicate become broken (can spuriously return true).
      Consider that runnext is not nil and the main array is empty. Runqempty
      observes that the array is empty, then it is descheduled for some time.
      Then queue owner pushes another element to the queue evicting runnext
      into the array. Then queue owner pops runnext. Then runqempty resumes
      and observes runnext is nil and returns true. But there were no point
      in time when the queue was empty.
      
      Fix runqempty predicate to not return true spuriously.
      
      Change-Id: Ifb7d75a699101f3ff753c4ce7c983cf08befd31e
      Reviewed-on: https://go-review.googlesource.com/20858Reviewed-by: default avatarAustin Clements <austin@google.com>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fcd7c02c