1. 13 Apr, 2016 19 commits
    • Robert Griesemer's avatar
      cmd/compile, go/importer: minor cleanups · eb79f21c
      Robert Griesemer authored
      Change-Id: Ic7a1fb0dbbf108052c970a4a830269a5673df7df
      Reviewed-on: https://go-review.googlesource.com/21963Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      eb79f21c
    • Robert Griesemer's avatar
      cmd/compile: move more compiler specifics into compiler specific export section · 7d0d1222
      Robert Griesemer authored
      Instead of indicating with each function signature if it has an inlineable
      body, collect all functions in order and export function bodies with function
      index in platform-specific section.
      
      Moves this compiler specific information out of the platform-independent
      export data section, and removes an int value for all functions w/o body.
      Also simplifies the code a bit.
      
      Change-Id: I8b2d7299dbe81f2706be49ecfb9d9f7da85fd854
      Reviewed-on: https://go-review.googlesource.com/21939Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      7d0d1222
    • Austin Clements's avatar
      runtime/internal/atomic: remove write barrier from Storep1 on s390x · d8e8fc29
      Austin Clements authored
      atomic.Storep1 is not supposed to invoke a write barrier (that's what
      atomicstorep is for), but currently does on s390x. This causes a panic
      in runtime.mapzero when it tries to use atomic.Storep1 to store what's
      actually a scalar.
      
      Fix this by eliminating the write barrier from atomic.Storep1 on
      s390x. Also add some documentation to atomicstorep to explain the
      difference between these.
      
      Fixes #15270.
      
      Change-Id: I291846732d82f090a218df3ef6351180aff54e81
      Reviewed-on: https://go-review.googlesource.com/21993Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarMichael Munday <munday@ca.ibm.com>
      d8e8fc29
    • David Chase's avatar
      cmd/compile: move spills to loop exits when easy. · 6b85a45e
      David Chase authored
      For call-free inner loops.
      
      Revised statistics:
        85 inner loop spills sunk
       341 inner loop spills remaining
      1162 inner loop spills that were candidates for sinking
           ended up completely register allocated
       119 inner loop spills could have been sunk were used in
           "shuffling" at the bottom of the loop.
         1 inner loop spill not sunk because the register assigned
           changed between def and exit,
      
       Understanding how to make an inner loop definition not be
       a candidate for from-memory shuffling (to force the shuffle
       code to choose some other value) should pick up some of the
       119 other spills disqualified for this reason.
      
       Modified the stats printing based on feedback from Austin.
      
      Change-Id: If3fb9b5d5a028f42ccc36c4e3d9e0da39db5ca60
      Reviewed-on: https://go-review.googlesource.com/21037Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6b85a45e
    • Lynn Boger's avatar
      runtime: improve memmove performance ppc64,ppc64le · c4807d4c
      Lynn Boger authored
      This change improves the performance of memmove
      on ppc64 & ppc64le mainly for moves >=32 bytes.
      In addition, the test to detect backward moves
       was enhanced to avoid backward moves if source
      and dest were in different types of storage, since
      backward moves might not always be efficient.
      
      Fixes #14507
      
      The following shows some of the improvements from the test
      in the runtime package:
      
      BenchmarkMemmove32                   4229.56      4717.13      1.12x
      BenchmarkMemmove64                   6156.03      7810.42      1.27x
      BenchmarkMemmove128                  7521.69      12468.54     1.66x
      BenchmarkMemmove256                  6729.90      18260.33     2.71x
      BenchmarkMemmove512                  8521.59      18033.81     2.12x
      BenchmarkMemmove1024                 9760.92      25762.61     2.64x
      BenchmarkMemmove2048                 10241.00     29584.94     2.89x
      BenchmarkMemmove4096                 10399.37     31882.31     3.07x
      
      BenchmarkMemmoveUnalignedDst16       1943.69      2258.33      1.16x
      BenchmarkMemmoveUnalignedDst32       3885.08      3965.81      1.02x
      BenchmarkMemmoveUnalignedDst64       5121.63      6965.54      1.36x
      BenchmarkMemmoveUnalignedDst128      7212.34      11372.68     1.58x
      BenchmarkMemmoveUnalignedDst256      6564.52      16913.59     2.58x
      BenchmarkMemmoveUnalignedDst512      8364.35      17782.57     2.13x
      BenchmarkMemmoveUnalignedDst1024     9539.87      24914.72     2.61x
      BenchmarkMemmoveUnalignedDst2048     9199.23      21235.11     2.31x
      BenchmarkMemmoveUnalignedDst4096     10077.39     25231.99     2.50x
      
      BenchmarkMemmoveUnalignedSrc32       3249.83      3742.52      1.15x
      BenchmarkMemmoveUnalignedSrc64       5562.35      6627.96      1.19x
      BenchmarkMemmoveUnalignedSrc128      6023.98      10200.84     1.69x
      BenchmarkMemmoveUnalignedSrc256      6921.83      15258.43     2.20x
      BenchmarkMemmoveUnalignedSrc512      8593.13      16541.97     1.93x
      BenchmarkMemmoveUnalignedSrc1024     9730.95      22927.84     2.36x
      BenchmarkMemmoveUnalignedSrc2048     9793.28      21537.73     2.20x
      BenchmarkMemmoveUnalignedSrc4096     10132.96     26295.06     2.60x
      
      Change-Id: I73af59970d4c97c728deabb9708b31ec7e01bdf2
      Reviewed-on: https://go-review.googlesource.com/21990Reviewed-by: default avatarBill O'Farrell <billotosyr@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c4807d4c
    • David Crawshaw's avatar
      cmd/link: use a switch for name prefix switching · 66afbf10
      David Crawshaw authored
      Minor cleanup.
      
      Change-Id: I7574f58a7e55c2bb798ebe9c7c98d36b8c258fb8
      Reviewed-on: https://go-review.googlesource.com/21982
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      66afbf10
    • David Crawshaw's avatar
      cmd/compile, etc: store method tables as offsets · 7d469179
      David Crawshaw authored
      This CL introduces the typeOff type and a lookup method of the same
      name that can turn a typeOff offset into an *rtype.
      
      In a typical Go binary (built with buildmode=exe, pie, c-archive, or
      c-shared), there is one moduledata and all typeOff values are offsets
      relative to firstmoduledata.types. This makes computing the pointer
      cheap in typical programs.
      
      With buildmode=shared (and one day, buildmode=plugin) there are
      multiple modules whose relative offset is determined at runtime.
      We identify a type in the general case by the pair of the original
      *rtype that references it and its typeOff value. We determine
      the module from the original pointer, and then use the typeOff from
      there to compute the final *rtype.
      
      To ensure there is only one *rtype representing each type, the
      runtime initializes a typemap for each module, using any identical
      type from an earlier module when resolving that offset. This means
      that types computed from an offset match the type mapped by the
      pointer dynamic relocations.
      
      A series of followup CLs will replace other *rtype values with typeOff
      (and name/*string with nameOff).
      
      For types created at runtime by reflect, type offsets are treated as
      global IDs and reference into a reflect offset map kept by the runtime.
      
      darwin/amd64:
      	cmd/go:  -57KB (0.6%)
      	jujud:  -557KB (0.8%)
      
      linux/amd64 PIE:
      	cmd/go: -361KB (3.0%)
      	jujud:  -3.5MB (4.2%)
      
      For #6853.
      
      Change-Id: Icf096fd884a0a0cb9f280f46f7a26c70a9006c96
      Reviewed-on: https://go-review.googlesource.com/21285Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7d469179
    • Alexandru Moșoi's avatar
      cmd/compile: use shared dom tree for cse, too · e0611b16
      Alexandru Moșoi authored
      Missed this in the previous CL where the shared
      dom tree was introduced.
      
      Change-Id: If0bd85d4b4567d7e87814ed511603b1303ab3903
      Reviewed-on: https://go-review.googlesource.com/21970
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      e0611b16
    • Shahar Kohanim's avatar
      cmd/link: rename Pcln to FuncInfo · 61b7a9c5
      Shahar Kohanim authored
      After non pcln fields were added to it in a previous commit.
      
      Change-Id: Icf92c0774d157c61399a6fc2a3c4d2cd47a634d2
      Reviewed-on: https://go-review.googlesource.com/21921
      Run-TryBot: Shahar Kohanim <skohanim@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      61b7a9c5
    • Tal Shprecher's avatar
      cmd/compile: make enqueued map keys fail validation on forward types · 24967ec1
      Tal Shprecher authored
      Map keys are currently validated in multiple locations but share
      a common validation routine. The problem is that early validations
      should be lenient enough to allow for forward types while the final
      validations should not. The final validations should fail on forward
      types since they've already settled.
      
      This change also separates the key type checking from the creation
      of the map via typMap. Instead of the mapqueue being populated in
      copytype() by checking the map line number, it's populated in the
      same block that validates the key type. This isolates key validation
      logic while type checking.
      
      Fixes #14988
      
      Change-Id: Ia47cf6213585d6c63b3a35249104c0439feae658
      Reviewed-on: https://go-review.googlesource.com/21830Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      24967ec1
    • Matthew Dempsky's avatar
      cmd/compile: fix crash on bare package name in constant declarations · 0e01db4b
      Matthew Dempsky authored
      Fixes #11361.
      
      Change-Id: I70b8808f97f0e07de680e7e6ede1322ea0fdbbc0
      Reviewed-on: https://go-review.googlesource.com/21936Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      0e01db4b
    • Tal Shprecher's avatar
      cmd/compile: remove unnecessary assignments while type checking. · 6531fab0
      Tal Shprecher authored
      Change-Id: Ica0ec84714d7f01d800d62fa10cdb08321d43cf3
      Reviewed-on: https://go-review.googlesource.com/21967Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      6531fab0
    • Matthew Dempsky's avatar
      runtime: simplify setPanicOnFault slightly · 6af4e996
      Matthew Dempsky authored
      No need to acquire the M just to change G's paniconfault flag, and the
      original C implementation of SetPanicOnFault did not. The M
      acquisition logic is an artifact of golang.org/cl/131010044, which was
      started before golang.org/cl/123640043 (which introduced the current
      "getg" function) was submitted.
      
      Change-Id: I6d1939008660210be46904395cf5f5bbc2c8f754
      Reviewed-on: https://go-review.googlesource.com/21935
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      6af4e996
    • Brad Fitzpatrick's avatar
      all: use new io.SeekFoo constants instead of os.SEEK_FOO · 381e5eee
      Brad Fitzpatrick authored
      Automated change.
      
      Fixes #15269
      
      Change-Id: I8deb2ac0101d3f7c390467ceb0a1561b72edbb2f
      Reviewed-on: https://go-review.googlesource.com/21962
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      381e5eee
    • Martin Möhrmann's avatar
      strings: improve explode and correct comment · 819e0b29
      Martin Möhrmann authored
      Merges explodetests into splittests which already contain
      some of the tests that cover explode.
      
      Adds a test to cover the utf8.RuneError branch in explode.
      
      name      old time/op  new time/op  delta
      Split1-2  14.9ms ± 0%  14.2ms ± 0%  -4.06%  (p=0.000 n=47+49)
      
      Change-Id: I00f796bd2edab70e926ea9e65439d820c6a28254
      Reviewed-on: https://go-review.googlesource.com/21609
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      819e0b29
    • Emmanuel Odeke's avatar
      html/template: add examples of loading templates from files · 3f66d8c8
      Emmanuel Odeke authored
      Adds examples showing loading templates from files and
      executing them.
      
      Shows examples:
      - Using ParseGlob.
      - Using ParseFiles.
      - Using helper functions to share and use templates
      in different contexts by adding them to an existing
      bundle of templates.
      - Using a group of driver templates with distinct sets
      of helper templates.
      
      Almost all of the code was directly copied from text/template.
      
      Fixes #8500
      
      Change-Id: Ic3d91d5232afc5a1cd2d8cd3d9a5f3b754c64225
      Reviewed-on: https://go-review.googlesource.com/21854Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      3f66d8c8
    • Josh Bleecher Snyder's avatar
      cmd/compile: teach CSE that new objects are bespoke · db5338f8
      Josh Bleecher Snyder authored
      runtime.newobject never returns the same thing twice,
      so the resulting value will never be a common subexpression.
      
      This helps when compiling large static data structures
      that include pointers, such as maps and slices.
      No clear performance impact on other code. (See below.)
      
      For the code in issue #15112:
      
      Before:
        real	1m14.238s
        user	1m18.985s
        sys	0m0.787s
      
      After:
        real	0m47.172s
        user	0m52.248s
        sys	0m0.767s
      
      For the code in issue #15235, size 10k:
      
      Before:
        real	0m44.916s
        user	0m46.577s
        sys	0m0.304s
      
      After:
        real	0m7.703s
        user	0m9.041s
        sys	0m0.316s
      
      Still more work to be done, particularly for #15112.
      
      Updates #15112
      Updates #15235
      
      
      name       old time/op      new time/op      delta
      Template        330ms ±11%       333ms ±13%    ~           (p=0.749 n=20+19)
      Unicode         148ms ± 6%       152ms ± 8%    ~           (p=0.072 n=18+20)
      GoTypes         1.01s ± 7%       1.01s ± 3%    ~           (p=0.583 n=20+20)
      Compiler        5.04s ± 2%       5.06s ± 2%    ~           (p=0.314 n=20+20)
      
      name       old user-ns/op   new user-ns/op   delta
      Template   444user-ms ±11%  445user-ms ±10%    ~           (p=0.738 n=20+20)
      Unicode    215user-ms ± 5%  218user-ms ± 5%    ~           (p=0.239 n=18+18)
      GoTypes    1.45user-s ± 3%  1.45user-s ± 4%    ~           (p=0.620 n=20+20)
      Compiler   7.23user-s ± 2%  7.22user-s ± 2%    ~           (p=0.901 n=20+19)
      
      name       old alloc/op     new alloc/op     delta
      Template       55.0MB ± 0%      55.0MB ± 0%    ~           (p=0.547 n=20+20)
      Unicode        37.6MB ± 0%      37.6MB ± 0%    ~           (p=0.301 n=20+20)
      GoTypes         177MB ± 0%       177MB ± 0%    ~           (p=0.065 n=20+19)
      Compiler        798MB ± 0%       797MB ± 0%  -0.05%        (p=0.000 n=19+20)
      
      name       old allocs/op    new allocs/op    delta
      Template         492k ± 0%        493k ± 0%  +0.03%        (p=0.030 n=20+20)
      Unicode          377k ± 0%        377k ± 0%    ~           (p=0.423 n=20+19)
      GoTypes         1.40M ± 0%       1.40M ± 0%    ~           (p=0.102 n=20+20)
      Compiler        5.53M ± 0%       5.53M ± 0%    ~           (p=0.094 n=17+18)
      
      name       old text-bytes   new text-bytes   delta
      HelloSize        561k ± 0%        561k ± 0%    ~     (all samples are equal)
      CmdGoSize       6.13M ± 0%       6.13M ± 0%    ~     (all samples are equal)
      
      name       old data-bytes   new data-bytes   delta
      HelloSize        128k ± 0%        128k ± 0%    ~     (all samples are equal)
      CmdGoSize        306k ± 0%        306k ± 0%    ~     (all samples are equal)
      
      name       old exe-bytes    new exe-bytes    delta
      HelloSize        905k ± 0%        905k ± 0%    ~     (all samples are equal)
      CmdGoSize       9.64M ± 0%       9.64M ± 0%    ~     (all samples are equal)
      
      Change-Id: Id774e2901d7701a3ec7a1c1d1cf1d9327a4107fc
      Reviewed-on: https://go-review.googlesource.com/21937
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarTodd Neal <todd@tneal.org>
      db5338f8
    • Keith Randall's avatar
      cmd/compile: fix arg to getcallerpc · 260b7daf
      Keith Randall authored
      getcallerpc's arg needs to point to the first argument slot.
      I believe this bug was introduced by Michel's itab changes
      (specifically https://go-review.googlesource.com/c/20902).
      
      Fixes #15145
      
      Change-Id: Ifb2e17f3658e2136c7950dfc789b4d5706320683
      Reviewed-on: https://go-review.googlesource.com/21931Reviewed-by: default avatarMichel Lespinasse <walken@google.com>
      260b7daf
    • Shahar Kohanim's avatar
      cmd/link: move function only lsym fields to pcln struct · b0cbe158
      Shahar Kohanim authored
      name       old secs    new secs    delta
      LinkCmdGo   0.53 ± 9%   0.53 ±10%  -1.30%  (p=0.022 n=100+99)
      
      name       old MaxRSS  new MaxRSS  delta
      LinkCmdGo   151k ± 4%   142k ± 6%  -5.92%  (p=0.000 n=98+100)
      
      Change-Id: Ic30e63a948f8e626b3396f458a0163f7234810c1
      Reviewed-on: https://go-review.googlesource.com/21920
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b0cbe158
  2. 12 Apr, 2016 21 commits