1. 21 Apr, 2017 20 commits
  2. 20 Apr, 2017 20 commits
    • Keith Randall's avatar
      cmd/compile: zero ambiguously live variables at VARKILLs · 38dee12d
      Keith Randall authored
      At VARKILLs, zero a variable if it is ambiguously live.
      After the VARKILL anything this variable references
      might be collected. If it were to become live again later,
      the GC will see references to already-collected objects.
      
      We don't know a variable is ambiguously live until very
      late in compilation (after lowering, register allocation, ...),
      so it is hard to generate the code in an arch-independent way.
      We also have to be careful not to clobber any registers.
      Fortunately, this almost never happens so performance is ~irrelevant.
      
      There are only 2 instances where this triggers in the stdlib.
      
      Fixes #20029
      
      Change-Id: Ia9585a91d7b823fad4a9d141d954464cc7af31f4
      Reviewed-on: https://go-review.googlesource.com/41076
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      38dee12d
    • Keith Randall's avatar
      cmd/vendor/arch/x86: pull new version from x repo · 7bd1c210
      Keith Randall authored
      Copied by hand.
      
      Update #17410
      Update #19142
      Fixes #19986
      
      Change-Id: I21d16d254161c75466b31c670f3b2c8c463abd66
      Reviewed-on: https://go-review.googlesource.com/41205
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      7bd1c210
    • Aliaksandr Valialkin's avatar
      sync: align poolLocal to CPU cache line size · 8aa31d5d
      Aliaksandr Valialkin authored
      Make poolLocal size multiple of 128, so it aligns to CPU cache line
      on the most common architectures.
      
      This also has the following benefits:
      
      - It may help compiler substituting integer multiplication
        by bit shift inside indexLocal.
      - It shrinks poolLocal size from 176 bytes to 128 bytes on amd64,
        so now it fits two cache lines (or a single cache line on certain
        Intel CPUs - see https://software.intel.com/en-us/articles/optimizing-application-performance-on-intel-coret-microarchitecture-using-hardware-implemented-prefetchers).
      
      No measurable performance changes on linux/amd64 and linux/386.
      
      Change-Id: I11df0f064718a662e77a85d88b8a15a8919f25e9
      Reviewed-on: https://go-review.googlesource.com/40918Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8aa31d5d
    • Alberto Donizetti's avatar
      cmd/compile: only print one error for bad-type literal in assignment · 3218b1aa
      Alberto Donizetti authored
      Fixes #8438
      
      Change-Id: Ib43cdcdc962a8d9e14faf984bc859a92ba1eb517
      Reviewed-on: https://go-review.googlesource.com/40531Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      3218b1aa
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: eliminate LSym.Version · 405a280d
      Josh Bleecher Snyder authored
      There were only two versions, 0 and 1,
      and the only user of version 1 was the assembler,
      to indicate that a symbol was static.
      
      Rename LSym.Version to Static,
      and add it to LSym.Attributes.
      Simplify call-sites.
      
      Passes toolstash-check.
      
      Change-Id: Iabd39918f5019cce78f381d13f0481ae09f3871f
      Reviewed-on: https://go-review.googlesource.com/41201
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      405a280d
    • Robert Griesemer's avatar
      go/gcimporter: fix importing of anonymous interfaces · 950fa673
      Robert Griesemer authored
      Imported interfaces must be completed, whether they are named or not.
      The original code was collecting all types (including anonymous ones)
      in the importer's typList. That list was used in the end to complete
      interface types. When we introduced tracking of named types only, we
      lost anonymous interfaces. Use an independent list of interface types
      so the completion code is independent of which types are tracked.
      
      Added test and factored some of the existing tests.
      
      Fixes #20046.
      
      Change-Id: Icd1329032aec33f96890380dd5042de3bef8cdc7
      Reviewed-on: https://go-review.googlesource.com/41198Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      950fa673
    • David Lazar's avatar
      runtime: make test independent of inlining · da75700a
      David Lazar authored
      TestBreakpoint expects to see "runtime.Breakpoint()" in the stack trace.
      If runtime.Breakpoint() is inlined, then the stack trace prints
      "runtime.Breakpoint(...)" since the runtime does not have information
      about arguments (or lack thereof) to inlined functions. This change
      makes the test independent of inlining by looking for the string
      "runtime.Breakpoint(". Now TestBreakpoint passes with -l=4.
      
      Change-Id: Ia044a8e8a4de2337cb2b393d6fa78c73a2f25926
      Reviewed-on: https://go-review.googlesource.com/40997
      Run-TryBot: David Lazar <lazard@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      da75700a
    • Austin Clements's avatar
      runtime/pprof: don't accept "," in profile PCs · 6f2e6f8d
      Austin Clements authored
      TestBlockProfile matches samples against a regexp that accepts "," in
      profile PCs. I suspect this was just a syntax mistake. Remove "," from
      the character class.
      
      Change-Id: Idcfc20ed6900075abae08597ba71db559e89b37b
      Reviewed-on: https://go-review.googlesource.com/41111
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: 's avatarPeter Weinberger <pjw@google.com>
      6f2e6f8d
    • Austin Clements's avatar
      runtime/pprof: accept fewer PCs · 4a439882
      Austin Clements authored
      TestBlockProfile currently requires exactly five PCs in each sample.
      With more aggressive inlining there may be fewer, so change this test
      to use the same pattern as TestMutexProfile, which accepts one or more
      PCs. With this change, this test passes when compiled with -l=4.
      
      Change-Id: I1421a6d56c96b77111bdc671d88723a222672fd6
      Reviewed-on: https://go-review.googlesource.com/41110
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Lazar <lazard@golang.org>
      4a439882
    • Josh Bleecher Snyder's avatar
      runtime: improve ExampleFrames · 56580756
      Josh Bleecher Snyder authored
      CL 40876 changed ExampleFrames so that the output
      was stable with and without mid-stack inlining.
      
      However, that change lost some of the
      pedagogical and copy/paste value of the example.
      It was unclear why both more and i were being tracked,
      and whether the 5 in i < 5 is related to len(pc),
      and if so, why and how.
      
      This CL rewrites the example with lots more comments,
      and such that the core structure more closely matches
      normal usage, and such that it is obvious
      which lines of code should be deleted when copying.
      As a bonus, it also now illustrates Frame.File.
      
      Change-Id: Iab73541dd096657ddf79c5795337e8b596d89740
      Reviewed-on: https://go-review.googlesource.com/41136
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      56580756
    • Austin Clements's avatar
      runtime/pprof: fix period information · 0c0c94a9
      Austin Clements authored
      The period recorded in CPU profiles is in nanoseconds, but was being
      computed incorrectly as hz * 1000. As a result, many absolute times
      displayed by pprof were incorrect.
      
      Fix this by computing the period correctly.
      
      Change-Id: I6fadd6d8ad3e57f31e8cc7a25a24fcaec510d8d4
      Reviewed-on: https://go-review.googlesource.com/40995
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      0c0c94a9
    • Samuel Tan's avatar
      html/template: ignore case when handling type attribute in script element · f3f3f0d6
      Samuel Tan authored
      Convert the parsed attribute name to lowercase before checking its value in
      the HTML parser state machine. This ensures that the type attribute in
      the script element is handled in a case-sensitive manner, just like all
      other attribute names.
      
      Fixes #19965
      
      Change-Id: I806d8c62aada2c3b5b4328aff75f217ea60cb339
      Reviewed-on: https://go-review.googlesource.com/40650
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      f3f3f0d6
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: make defframe arch-independent · 263ba3ac
      Matthew Dempsky authored
      The arch backends no longer depend on gc.Node.
      
      Passes toolstash-check -all.
      
      Change-Id: Ic7e49ae0a3ed155a2761c25e17cc341b46333fb4
      Reviewed-on: https://go-review.googlesource.com/41196
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      263ba3ac
    • Ilya Tocar's avatar
      cmd/internal/obj/x86: fix relocation offset for VEX encoded instructions · 7f983225
      Ilya Tocar authored
      VEX encoded instructions don't have a REX byte, so for PC relative
      addressing we don't need to recalculate relocation offset.
      
      Fixes #19518
      
      Change-Id: Icf5414962de4350d76fd220817498337f90614fc
      Reviewed-on: https://go-review.googlesource.com/38138
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      7f983225
    • Samuel Tan's avatar
      html/template: ensure that MIME type handling is case insensitive · 4646a330
      Samuel Tan authored
      Handle MIME types found in the type attribute of the script element
      in a case insensitive way, as per Section 5.1 of RFC 2045.
      
      Fixes #19968
      
      Change-Id: Ie1416178c937dcf2c96bcec4191cebe7c3477af8
      Reviewed-on: https://go-review.googlesource.com/40702Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4646a330
    • Lynn Boger's avatar
      cmd/compile: add rotates to PPC64.rules · 9248ff46
      Lynn Boger authored
      This updates PPC64.rules to include rules to generate rotates
      for ADD, OR, XOR operators that combine two opposite shifts
      that sum to 32 or 64.
      
      To support this change opcodes for ROTL and ROTLW were added to
      be used like the rotldi and rotlwi extended mnemonics.
      
      This provides the following improvement in sha3:
      
      BenchmarkPermutationFunction-8     302.83       376.40       1.24x
      BenchmarkSha3_512_MTU-8            98.64        121.92       1.24x
      BenchmarkSha3_384_MTU-8            136.80       168.30       1.23x
      BenchmarkSha3_256_MTU-8            169.21       211.29       1.25x
      BenchmarkSha3_224_MTU-8            179.76       221.19       1.23x
      BenchmarkShake128_MTU-8            212.87       263.23       1.24x
      BenchmarkShake256_MTU-8            196.62       245.60       1.25x
      BenchmarkShake256_16x-8            163.57       194.37       1.19x
      BenchmarkShake256_1MiB-8           199.02       248.74       1.25x
      BenchmarkSha3_512_1MiB-8           106.55       133.13       1.25x
      
      Fixes #20030
      
      Change-Id: I484c56f48395d32f53ff3ecb3ac6cb8191cfee44
      Reviewed-on: https://go-review.googlesource.com/40992
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      Reviewed-by: 's avatarMichael Munday <munday@ca.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9248ff46
    • Alberto Donizetti's avatar
      cmd/trace: document that trace viewer is only tested on chromium · 865b50c9
      Alberto Donizetti authored
      Fixes #19207
      
      Change-Id: I69b70492fd01599a13c1a3beb87f492de40a18b0
      Reviewed-on: https://go-review.googlesource.com/37312Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      865b50c9
    • James Neve's avatar
      doc: escape some HTML in Effective Go code examples · 868bb5d2
      James Neve authored
      Change-Id: I4204e268c7220a50ceb270432067850ec2b5af80
      Reviewed-on: https://go-review.googlesource.com/41230Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      868bb5d2
    • Josh Bleecher Snyder's avatar
      cmd/compile: rework handling of udiv on ARM · 01b1a34a
      Josh Bleecher Snyder authored
      Instead of populating the aux symbol
      of CALLudiv during rewrite rules,
      populate it during genssa.
      
      This simplifies the rewrite rules.
      It also removes all remaining calls
      to ctxt.Lookup from any rewrite rules.
      This is a first step towards removing
      ctxt from ssa.Cache entirely,
      and also a first step towards converting
      the obj.LSym.Version field into a boolean.
      It should also speed up compilation.
      
      Also, move func udiv into package runtime.
      That's where it is anyway,
      and it lets udiv look and act like the rest of
      the runtime support functions.
      
      Change-Id: I41462a632c14fdc41f61b08049ec13cd80a87bfe
      Reviewed-on: https://go-review.googlesource.com/41191
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      01b1a34a
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: split Link.hash into version 0 and 1 · 6e97c71c
      Josh Bleecher Snyder authored
      Though LSym.Version is an int, it can only have the value 0 or 1.
      Using that, split Link.hash into two maps, one for version 0
      (which is far more common) and one for version 1.
      This lets use just the name for lookups,
      which is both faster and more compact.
      This matters because Link.hash map lookups are frequent,
      and will be contended once the backend is concurrent.
      
      name        old time/op       new time/op       delta
      Template          194ms ± 3%        192ms ± 5%  -1.46%  (p=0.000 n=47+49)
      Unicode          84.5ms ± 3%       83.8ms ± 3%  -0.81%  (p=0.011 n=50+49)
      GoTypes           543ms ± 2%        545ms ± 4%    ~     (p=0.566 n=46+49)
      Compiler          2.48s ± 2%        2.48s ± 3%    ~     (p=0.706 n=47+50)
      SSA               5.94s ± 3%        5.98s ± 2%  +0.55%  (p=0.040 n=49+50)
      Flate             119ms ± 6%        119ms ± 4%    ~     (p=0.681 n=48+47)
      GoParser          145ms ± 4%        145ms ± 3%    ~     (p=0.662 n=47+49)
      Reflect           348ms ± 3%        344ms ± 3%  -1.17%  (p=0.000 n=47+47)
      Tar               105ms ± 4%        104ms ± 3%    ~     (p=0.155 n=50+47)
      XML               197ms ± 2%        197ms ± 3%    ~     (p=0.666 n=49+49)
      [Geo mean]        332ms             331ms       -0.37%
      
      name        old user-time/op  new user-time/op  delta
      Template          230ms ±10%        226ms ±10%  -1.85%  (p=0.041 n=50+50)
      Unicode           104ms ± 6%        103ms ± 5%    ~     (p=0.076 n=49+49)
      GoTypes           707ms ± 4%        705ms ± 5%    ~     (p=0.521 n=50+50)
      Compiler          3.30s ± 3%        3.33s ± 4%  +0.76%  (p=0.003 n=50+49)
      SSA               8.17s ± 4%        8.23s ± 3%  +0.66%  (p=0.030 n=50+49)
      Flate             139ms ± 6%        138ms ± 8%    ~     (p=0.184 n=49+48)
      GoParser          174ms ± 5%        172ms ± 6%    ~     (p=0.107 n=48+49)
      Reflect           431ms ± 8%        420ms ± 5%  -2.57%  (p=0.000 n=50+46)
      Tar               119ms ± 6%        118ms ± 7%  -0.95%  (p=0.033 n=50+49)
      XML               236ms ± 4%        236ms ± 4%    ~     (p=0.935 n=50+48)
      [Geo mean]        410ms             407ms       -0.67%
      
      name        old alloc/op      new alloc/op      delta
      Template         38.7MB ± 0%       38.6MB ± 0%  -0.29%  (p=0.008 n=5+5)
      Unicode          29.8MB ± 0%       29.7MB ± 0%  -0.24%  (p=0.008 n=5+5)
      GoTypes           113MB ± 0%        113MB ± 0%  -0.29%  (p=0.008 n=5+5)
      Compiler          462MB ± 0%        462MB ± 0%  -0.12%  (p=0.008 n=5+5)
      SSA              1.27GB ± 0%       1.27GB ± 0%  -0.05%  (p=0.008 n=5+5)
      Flate            25.2MB ± 0%       25.1MB ± 0%  -0.37%  (p=0.008 n=5+5)
      GoParser         31.7MB ± 0%       31.6MB ± 0%    ~     (p=0.056 n=5+5)
      Reflect          77.5MB ± 0%       77.2MB ± 0%  -0.38%  (p=0.008 n=5+5)
      Tar              26.4MB ± 0%       26.3MB ± 0%    ~     (p=0.151 n=5+5)
      XML              41.9MB ± 0%       41.9MB ± 0%  -0.20%  (p=0.032 n=5+5)
      [Geo mean]       74.5MB            74.3MB       -0.23%
      
      name        old allocs/op     new allocs/op     delta
      Template           378k ± 1%         377k ± 1%    ~     (p=0.690 n=5+5)
      Unicode            321k ± 0%         322k ± 0%    ~     (p=0.595 n=5+5)
      GoTypes           1.14M ± 0%        1.14M ± 0%    ~     (p=0.310 n=5+5)
      Compiler          4.25M ± 0%        4.25M ± 0%    ~     (p=0.151 n=5+5)
      SSA               9.84M ± 0%        9.84M ± 0%    ~     (p=0.841 n=5+5)
      Flate              232k ± 1%         232k ± 0%    ~     (p=0.690 n=5+5)
      GoParser           315k ± 1%         315k ± 1%    ~     (p=0.841 n=5+5)
      Reflect            970k ± 0%         970k ± 0%    ~     (p=0.841 n=5+5)
      Tar                248k ± 0%         248k ± 1%    ~     (p=0.841 n=5+5)
      XML                389k ± 0%         389k ± 0%    ~     (p=1.000 n=5+5)
      [Geo mean]         724k              724k       +0.01%
      
      Updates #15756
      
      Change-Id: I2646332e89f0444ca9d5a41d7172537d904ed636
      Reviewed-on: https://go-review.googlesource.com/41050
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      6e97c71c