1. 21 Mar, 2017 20 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: remove function-name-based debuglive tweaks · 10fdf769
      Josh Bleecher Snyder authored
      It's easier to grep output than recompile the compiler anyway.
      
      For concurrent compilation.
      
      Updates #15756
      
      Change-Id: I151cb5dc77056469cd9019d516f86454e931a197
      Reviewed-on: https://go-review.googlesource.com/38424
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      10fdf769
    • Josh Bleecher Snyder's avatar
      cmd/compile: eliminate a Curfn reference in plive · 89840e4a
      Josh Bleecher Snyder authored
      I think this got lost in a rebase somewhere.
      
      Updates #15756
      
      Change-Id: Ia3e7c60d1b9254f2877217073732b46c91059ade
      Reviewed-on: https://go-review.googlesource.com/38425
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      89840e4a
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: fix liveness regression · baa0fdd0
      Matthew Dempsky authored
      During AllocFrame, we drop unused variables from Curfn.Func.Dcl, but
      there might still be OpVarFoo instructions that reference those
      variables. This wasn't a problem though because gvardefx used to emit
      ANOP for unused variables instead of AVARFOO.
      
      As an easy fix, if we see OpVarFoo (or OpKeepAlive) referencing an
      unused variable, we can ignore it.
      
      Fixes #19632.
      
      Change-Id: I4e9ffabdb4058f7cdcc4663b540f5a5a692daf8b
      Reviewed-on: https://go-review.googlesource.com/38400Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      baa0fdd0
    • Daniel Martí's avatar
      runtime: remove unused *chantype parameters · 2e29eb57
      Daniel Martí authored
      The chanrecv funcs don't use it at all. The chansend ones do, but the
      element type is now part of the hchan struct, which is already a
      parameter.
      
      hchan can be nil in chansend when sending to a nil channel, so when
      instrumenting we must copy to the stack to be able to read the channel
      type.
      
      name             old time/op  new time/op  delta
      ChanUncontended  6.42µs ± 1%  6.22µs ± 0%  -3.06%  (p=0.000 n=19+18)
      
      Initially found by github.com/mvdan/unparam.
      
      Fixes #19591.
      
      Change-Id: I3a5e8a0082e8445cc3f0074695e3593fd9c88412
      Reviewed-on: https://go-review.googlesource.com/38351
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      2e29eb57
    • Brad Fitzpatrick's avatar
      flag: validate Int and Uint values to be in range · c65ceff1
      Brad Fitzpatrick authored
      Fixes #19230
      
      Change-Id: I38df9732b88f0328506e74f1a46f52adf47db1e5
      Reviewed-on: https://go-review.googlesource.com/38419Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c65ceff1
    • Vladimir Stefanovic's avatar
      cmd/compile,runtime: fix atomic And8 for mipsle · 24dc8c6c
      Vladimir Stefanovic authored
      Removing stray xori that came from big endian copy/paste.
      Adding atomicand8 check to runtime.check() that would have revealed
      this error.
      Might fix #19396.
      
      Change-Id: If8d6f25d3e205496163541eb112548aa66df9c2a
      Reviewed-on: https://go-review.googlesource.com/38257
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      24dc8c6c
    • Lynn Boger's avatar
      cmd/compile: improve LoweredZero performance for ppc64x · 23bd9191
      Lynn Boger authored
      This change improves the performance of the LoweredZero rule
      on ppc64x.
      
      The improvement can be seen in the runtime ClearFat
      benchmarks:
      
      BenchmarkClearFat12-16       2.40          0.69          -71.25%
      BenchmarkClearFat16-16       9.98          0.93          -90.68%
      BenchmarkClearFat24-16       4.75          0.93          -80.42%
      BenchmarkClearFat32-16       6.02          0.93          -84.55%
      BenchmarkClearFat40-16       7.19          1.16          -83.87%
      BenchmarkClearFat48-16       15.0          1.39          -90.73%
      BenchmarkClearFat56-16       9.95          1.62          -83.72%
      BenchmarkClearFat64-16       18.0          1.86          -89.67%
      BenchmarkClearFat128-16      30.0          8.08          -73.07%
      BenchmarkClearFat256-16      52.5          11.3          -78.48%
      BenchmarkClearFat512-16      97.0          19.0          -80.41%
      BenchmarkClearFat1024-16     244           34.2          -85.98%
      
      Fixes: #19532
      
      Change-Id: If493e28bc1d8e61bc79978498be9f5336a36cd3f
      Reviewed-on: https://go-review.googlesource.com/38096
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMichael Munday <munday@ca.ibm.com>
      23bd9191
    • Volker Dobler's avatar
      net/http/cookiejar: fix out-of-bounds errors on malformed domains · d972dc2d
      Volker Dobler authored
      The old implementation of Jar made the assumption that the host names
      in the URLs given to SetCookies() and Cookies() methods are well-formed.
      This is not an unreasonable assumption as malformed host names do not
      trigger calls to SetCookies or Cookies (at least not from net/http)
      as the HTTP request themselves are not executed. But there can be other
      invocations of these methods and at least on Linux it was possible to
      make DNS lookup to domain names with two trailing dots (see issue #7122).
      
      This is an old bug and this CL revives an old change (see
      https://codereview.appspot.com/52100043) to fix the issue. The discussion
      around 52100043 focused on the interplay between the jar and the
      public suffix list and who is responsible for which type if domain name
      canonicalization. The new bug report in issue #19384 used a nil public
      suffix list which demonstrates that the package cookiejar alone exhibits
      this problem and any solution cannot be fully delegated to the
      implementation of the used PublicSuffixList: Package cookiejar itself
      needs to protect against host names of the form ".." which triggered an
      out-of-bounds error.
      
      This CL does not address the issue of host name canonicalization and
      the question who is responsible for it. This CL just prevents the
      out-of-bounds error: It is a very conservative change, i.e. one might
      still set and retrieve cookies for host names like "weird.stuf...".
      Several more test cases document how the current code works.
      
      Fixes #19384.
      
      Change-Id: I14be080e8a2a0b266ced779f2aeb18841b730610
      Reviewed-on: https://go-review.googlesource.com/37843
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      d972dc2d
    • Hugues Bruant's avatar
      runtime: add mapdelete_fast* · 5d6b7fca
      Hugues Bruant authored
      Add benchmarks for map delete with int32/int64/string key
      
      Benchmark results on darwin/amd64
      
      name                 old time/op  new time/op  delta
      MapDelete/Int32/1-8   151ns ± 8%    99ns ± 3%  -34.39%  (p=0.008 n=5+5)
      MapDelete/Int32/2-8   128ns ± 2%   111ns ±15%  -13.40%  (p=0.040 n=5+5)
      MapDelete/Int32/4-8   128ns ± 5%   114ns ± 2%  -10.82%  (p=0.008 n=5+5)
      MapDelete/Int64/1-8   144ns ± 0%   104ns ± 3%  -27.53%  (p=0.016 n=4+5)
      MapDelete/Int64/2-8   153ns ± 1%   126ns ± 3%  -17.17%  (p=0.008 n=5+5)
      MapDelete/Int64/4-8   178ns ± 3%   136ns ± 2%  -23.60%  (p=0.008 n=5+5)
      MapDelete/Str/1-8     187ns ± 3%   171ns ± 3%   -8.54%  (p=0.008 n=5+5)
      MapDelete/Str/2-8     221ns ± 3%   206ns ± 4%   -7.18%  (p=0.016 n=5+4)
      MapDelete/Str/4-8     256ns ± 5%   232ns ± 2%   -9.36%  (p=0.016 n=4+5)
      
      name                     old time/op    new time/op    delta
      BinaryTree17-8              2.78s ± 7%     2.70s ± 1%    ~     (p=0.151 n=5+5)
      Fannkuch11-8                3.21s ± 2%     3.19s ± 1%    ~     (p=0.310 n=5+5)
      FmtFprintfEmpty-8          49.1ns ± 3%    50.2ns ± 2%    ~     (p=0.095 n=5+5)
      FmtFprintfString-8         78.6ns ± 4%    80.2ns ± 5%    ~     (p=0.460 n=5+5)
      FmtFprintfInt-8            79.7ns ± 1%    81.0ns ± 3%    ~     (p=0.103 n=5+5)
      FmtFprintfIntInt-8          117ns ± 2%     119ns ± 0%    ~     (p=0.079 n=5+4)
      FmtFprintfPrefixedInt-8     153ns ± 1%     146ns ± 3%  -4.19%  (p=0.024 n=5+5)
      FmtFprintfFloat-8           239ns ± 1%     237ns ± 1%    ~     (p=0.246 n=5+5)
      FmtManyArgs-8               506ns ± 2%     509ns ± 2%    ~     (p=0.238 n=5+5)
      GobDecode-8                7.06ms ± 4%    6.86ms ± 1%    ~     (p=0.222 n=5+5)
      GobEncode-8                6.01ms ± 5%    5.87ms ± 2%    ~     (p=0.222 n=5+5)
      Gzip-8                      246ms ± 4%     236ms ± 1%  -4.12%  (p=0.008 n=5+5)
      Gunzip-8                   37.7ms ± 4%    37.3ms ± 1%    ~     (p=0.841 n=5+5)
      HTTPClientServer-8         64.9µs ± 1%    64.4µs ± 0%  -0.80%  (p=0.032 n=5+4)
      JSONEncode-8               16.0ms ± 2%    16.2ms ±11%    ~     (p=0.548 n=5+5)
      JSONDecode-8               53.2ms ± 2%    53.1ms ± 4%    ~     (p=1.000 n=5+5)
      Mandelbrot200-8            4.33ms ± 2%    4.32ms ± 2%    ~     (p=0.841 n=5+5)
      GoParse-8                  3.24ms ± 2%    3.27ms ± 4%    ~     (p=0.690 n=5+5)
      RegexpMatchEasy0_32-8      86.2ns ± 1%    85.2ns ± 3%    ~     (p=0.286 n=5+5)
      RegexpMatchEasy0_1K-8       198ns ± 2%     199ns ± 1%    ~     (p=0.310 n=5+5)
      RegexpMatchEasy1_32-8      82.6ns ± 2%    81.8ns ± 1%    ~     (p=0.294 n=5+5)
      RegexpMatchEasy1_1K-8       359ns ± 2%     354ns ± 1%  -1.39%  (p=0.048 n=5+5)
      RegexpMatchMedium_32-8      123ns ± 2%     123ns ± 1%    ~     (p=0.905 n=5+5)
      RegexpMatchMedium_1K-8     38.2µs ± 2%    38.6µs ± 8%    ~     (p=0.690 n=5+5)
      RegexpMatchHard_32-8       1.92µs ± 2%    1.91µs ± 5%    ~     (p=0.460 n=5+5)
      RegexpMatchHard_1K-8       57.6µs ± 1%    57.0µs ± 2%    ~     (p=0.310 n=5+5)
      Revcomp-8                   483ms ± 7%     441ms ± 1%  -8.79%  (p=0.016 n=5+4)
      Template-8                 58.0ms ± 1%    58.2ms ± 7%    ~     (p=0.310 n=5+5)
      TimeParse-8                 324ns ± 6%     312ns ± 2%    ~     (p=0.087 n=5+5)
      TimeFormat-8                330ns ± 1%     329ns ± 1%    ~     (p=0.968 n=5+5)
      
      name                     old speed      new speed      delta
      GobDecode-8               109MB/s ± 4%   112MB/s ± 1%    ~     (p=0.222 n=5+5)
      GobEncode-8               128MB/s ± 5%   131MB/s ± 2%    ~     (p=0.222 n=5+5)
      Gzip-8                   78.9MB/s ± 4%  82.3MB/s ± 1%  +4.25%  (p=0.008 n=5+5)
      Gunzip-8                  514MB/s ± 4%   521MB/s ± 1%    ~     (p=0.841 n=5+5)
      JSONEncode-8              121MB/s ± 2%   120MB/s ±10%    ~     (p=0.548 n=5+5)
      JSONDecode-8             36.5MB/s ± 2%  36.6MB/s ± 4%    ~     (p=1.000 n=5+5)
      GoParse-8                17.9MB/s ± 2%  17.7MB/s ± 4%    ~     (p=0.730 n=5+5)
      RegexpMatchEasy0_32-8     371MB/s ± 1%   375MB/s ± 3%    ~     (p=0.310 n=5+5)
      RegexpMatchEasy0_1K-8    5.15GB/s ± 1%  5.13GB/s ± 1%    ~     (p=0.548 n=5+5)
      RegexpMatchEasy1_32-8     387MB/s ± 2%   391MB/s ± 1%    ~     (p=0.310 n=5+5)
      RegexpMatchEasy1_1K-8    2.85GB/s ± 2%  2.89GB/s ± 1%    ~     (p=0.056 n=5+5)
      RegexpMatchMedium_32-8   8.07MB/s ± 2%  8.06MB/s ± 1%    ~     (p=0.730 n=5+5)
      RegexpMatchMedium_1K-8   26.8MB/s ± 2%  26.6MB/s ± 7%    ~     (p=0.690 n=5+5)
      RegexpMatchHard_32-8     16.7MB/s ± 2%  16.7MB/s ± 5%    ~     (p=0.421 n=5+5)
      RegexpMatchHard_1K-8     17.8MB/s ± 1%  18.0MB/s ± 2%    ~     (p=0.310 n=5+5)
      Revcomp-8                 527MB/s ± 6%   577MB/s ± 1%  +9.44%  (p=0.016 n=5+4)
      Template-8               33.5MB/s ± 1%  33.4MB/s ± 7%    ~     (p=0.310 n=5+5)
      
      Updates #19495
      
      Change-Id: Ib9ece1690813d9b4788455db43d30891e2138df5
      Reviewed-on: https://go-review.googlesource.com/38172Reviewed-by: default avatarHugues Bruant <hugues.bruant@gmail.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5d6b7fca
    • Alex Brainman's avatar
      runtime: import os package in BenchmarkRunningGoProgram · f2b79cad
      Alex Brainman authored
      I would like to use BenchmarkRunningGoProgram to measure
      changes for issue #15588. So the program in the benchmark
      should import "os" package.
      
      It is also reasonable that basic Go program includes
      "os" package.
      
      For #15588.
      
      Change-Id: Ida6712eab22c2e79fbe91b6fdd492eaf31756852
      Reviewed-on: https://go-review.googlesource.com/37914
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      f2b79cad
    • Josh Bleecher Snyder's avatar
      cmd/compile: fix pos of typenames created during SSA construction · 165a96e2
      Josh Bleecher Snyder authored
      Prior to this CL, the function's position was used.
      The dottype Node's position is clearly better.
      
      I'm not thrilled about introducing a reference to
      lineno in the middle of SSA construction;
      I will have to remove it later.
      My immediate goal is stability and correctness of positions,
      though, since that aids refactoring, so this is an improvement.
      
      An example from package io:
      
      func (t *multiWriter) WriteString(s string) (n int, err error) {
      	var p []byte // lazily initialized if/when needed
      	for _, w := range t.writers {
      		if sw, ok := w.(stringWriter); ok {
      			n, err = sw.WriteString(s)
      
      The w.(stringWriter) type assertion includes loading
      the address of static type data for stringWriter:
      
      LEAQ	type."".stringWriter(SB), R10
      
      Prior to this CL, this instruction was given the line number
      of the function declaration.
      After this CL, this instruction is given the line number
      of the type assertion itself.
      
      Change-Id: Ifcca274b581a5a57d7e3102c4d7b7786bf307210
      Reviewed-on: https://go-review.googlesource.com/38389
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      165a96e2
    • Rob Pike's avatar
      encoding/gob: document the extra byte after a singleton · 67a46cc1
      Rob Pike authored
      This paragraph has been added, as the notion was missing from the
      documentation.
      
      If a value is passed to Encode and the type is not a struct (or pointer to struct,
      etc.), for simplicity of processing it is represented as a struct of one field.
      The only visible effect of this is to encode a zero byte after the value, just as
      after the last field of an encoded struct, so that the decode algorithm knows when
      the top-level value is complete.
      
      Fixes #16978
      
      Change-Id: I5f008e792d1b6fe80d2e026a7ff716608889db32
      Reviewed-on: https://go-review.googlesource.com/38414Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      67a46cc1
    • Rob Pike's avatar
      text/template,html/template: state that Funcs must happen before parsing · 5c5a1069
      Rob Pike authored
      Any method that affects the parse must happen before parsing.
      This obvious point is clear, but it's not clear to some that the
      set of defined functions affect the parse.
      
      Fixes #18971
      
      Change-Id: I8b7f8c8cf85b028c18e5ca3b9797de92ea910669
      Reviewed-on: https://go-review.googlesource.com/38413Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      5c5a1069
    • Josh Bleecher Snyder's avatar
      cmd/compile: check for missing function body earlier · 0dafb7d9
      Josh Bleecher Snyder authored
      Tested by fixedbugs/issue3705.go.
      
      This removes a dependency on lineno
      from near the backend.
      
      Change-Id: I228bd0ad7295cf881b9bdeb0df9d18483fb96821
      Reviewed-on: https://go-review.googlesource.com/38382
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      0dafb7d9
    • Josh Bleecher Snyder's avatar
      cmd/compile: use autogenerated position for init functions · 49a533e2
      Josh Bleecher Snyder authored
      This eliminates an old TODO,
      and stabilizes the position information
      for init functions.
      
      Change-Id: Idf2d9a16a60e097ee08f42541b87e170da2f9d3a
      Reviewed-on: https://go-review.googlesource.com/38388
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      49a533e2
    • Daniel Martí's avatar
      go/build: remove unused returnImports parameter · 346d5883
      Daniel Martí authored
      The code uses the filename suffix instead of the bool parameter to
      determine what to do.
      
      Fixes #19474.
      
      Change-Id: Ic552a54e50194592a4b4ae7f74d3109af54e6d36
      Reviewed-on: https://go-review.googlesource.com/38265
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      346d5883
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: remove unneeded Type.Pos field · 80c4b53e
      Matthew Dempsky authored
      Change-Id: I9ab650d9d2d0a99186009362454e1eabc9f6bad6
      Reviewed-on: https://go-review.googlesource.com/38393
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      80c4b53e
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: export interface embedding information · ee272bbf
      Matthew Dempsky authored
      Fixes #16369.
      
      Change-Id: I23f8c36370d0da37ac5b5126d012d22f78782782
      Reviewed-on: https://go-review.googlesource.com/38392
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      ee272bbf
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: handle recursive interfaces better · 07de3465
      Matthew Dempsky authored
      Previously, we handled recursive interfaces by deferring typechecking
      of interface methods, while eagerly expanding interface embeddings.
      
      This CL switches to eagerly evaluating interface methods, and
      deferring expanding interface embeddings to dowidth. This allows us to
      detect recursive interface embeddings with the same mechanism used for
      detecting recursive struct embeddings.
      
      Updates #16369.
      
      Change-Id: If4c0320058047f8a2d9b52b9a79de47eb9887f95
      Reviewed-on: https://go-review.googlesource.com/38391
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      07de3465
    • Jakob Borg's avatar
      net/http: fix ProxyFromEnvironment panic on invalid $NO_PROXY value · 4e35e5fc
      Jakob Borg authored
      Given an entry in $no_proxy like ":1" we would interpret it as an empty
      host name and a port number, then check the first character of the host
      name for dots. This would then cause an index out of range panic. This
      change simply skips these entries, as the following checks would anyway
      have returned false.
      
      Fixes #19536
      
      Change-Id: Iafe9c7a77ad4a6278c8ccb00a1575b56e4bdcd79
      Reviewed-on: https://go-review.googlesource.com/38067Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4e35e5fc
  2. 20 Mar, 2017 20 commits