1. 26 Aug, 2016 12 commits
  2. 25 Aug, 2016 19 commits
    • Josh Bleecher Snyder's avatar
      net/http, cmd/compile: minor vet fixes · f9acd391
      Josh Bleecher Snyder authored
      Updates #11041
      
      Change-Id: Ia0151723e3bc0d163cc687a02bfc5e0285d95ffa
      Reviewed-on: https://go-review.googlesource.com/27810
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f9acd391
    • Keith Randall's avatar
      cmd/compile: inline atomics from runtime/internal/atomic on amd64 · 320ddcf8
      Keith Randall authored
      Inline atomic reads and writes on amd64.  There's no reason
      to pay the overhead of a call for these.
      
      To keep atomic loads from being reordered, we make them
      return a <value,memory> tuple.
      
      Change the meaning of resultInArg0 for tuple-generating ops
      to mean the first part of the result tuple, not the second.
      This means we can always put the store part of the tuple last,
      matching how arguments are laid out.  This requires reordering
      the outputs of add32carry and sub32carry and their descendents
      in various architectures.
      
      benchmark                    old ns/op     new ns/op     delta
      BenchmarkAtomicLoad64-8      2.09          0.26          -87.56%
      BenchmarkAtomicStore64-8     7.54          5.72          -24.14%
      
      TBD (in a different CL): Cas, Or8, ...
      
      Change-Id: I713ea88e7da3026c44ea5bdb56ed094b20bc5207
      Reviewed-on: https://go-review.googlesource.com/27641Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      320ddcf8
    • Josh Bleecher Snyder's avatar
      all: fix assembly vet issues · 71ab9fa3
      Josh Bleecher Snyder authored
      Add missing function prototypes.
      Fix function prototypes.
      Use FP references instead of SP references.
      Fix variable names.
      Update comments.
      Clean up whitespace. (Not for vet.)
      
      All fairly minor fixes to make vet happy.
      
      Updates #11041
      
      Change-Id: Ifab2cdf235ff61cdc226ab1d84b8467b5ac9446c
      Reviewed-on: https://go-review.googlesource.com/27713
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      71ab9fa3
    • Joe Tsai's avatar
      archive/tar: isolate regular and sparse file handling as methods · 6af7639a
      Joe Tsai authored
      Factor out the regular file handling logic into handleRegularFile
      from nextHeader. We will need to reuse this logic when fixing #15573
      in a future CL.
      
      Factor out the sparse file handling logic into handleSparseFile.
      Currently this logic is split between nextHeader (for GNU sparse
      files) and Next (for PAX sparse files). Instead, we move this
      related code into a single method.
      
      There is no overall logic change. Thus, no unit tests.
      
      Updates #15573 #15564
      
      Change-Id: I3b8270d8b4e080e77d6c0df6a123d677c82cc466
      Reviewed-on: https://go-review.googlesource.com/27454Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6af7639a
    • Sina Siadat's avatar
      net/http: send Content-Range if no byte range overlaps · aa9b3d70
      Sina Siadat authored
      RFC 7233, section 4.4 says:
      >>>
      For byte ranges, failing to overlap the current extent means that the
      first-byte-pos of all of the byte-range-spec values were greater than the
      current length of the selected representation.  When this status code is
      generated in response to a byte-range request, the sender SHOULD generate a
      Content-Range header field specifying the current length of the selected
      representation
      <<<
      
      Thus, we should send the Content-Range only if none of the ranges
      overlap.
      
      Fixes #15798.
      
      Change-Id: Ic9a3e1b3a8730398b4bdff877a8f2fd2e30149e3
      Reviewed-on: https://go-review.googlesource.com/24212
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      aa9b3d70
    • Josh Bleecher Snyder's avatar
      cmd/compile: when inlining ==, don’t take the address of the values · 0bc94a88
      Josh Bleecher Snyder authored
      This CL reworks walkcompare for clarity and concision.
      It also makes one significant functional change.
      (The functional change is hard to separate cleanly
      from the cleanup, so I just did them together.)
      When inlining and unrolling an equality comparison
      for a small struct or array, compare the elements like:
      
      a[0] == b[0] && a[1] == b[1]
      
      rather than
      
      pa := &a
      pb := &b
      pa[0] == pb[0] && pa[1] == pb[1]
      
      The result is the same, but taking the address
      and working through the indirect
      forces the backends to generate less efficient code.
      
      This is only an improvement with the SSA backend.
      However, every port but s390x now has a working
      SSA backend, and switching to the SSA backend
      by default everywhere is a priority for Go 1.8.
      It thus seems reasonable to start to prioritize
      SSA performance over the old backend.
      
      Updates #15303
      
      
      Sample code:
      
      type T struct {
      	a, b int8
      }
      
      func g(a T) bool {
      	return a == T{1, 2}
      }
      
      
      SSA before:
      
      "".g t=1 size=80 args=0x10 locals=0x8
      	0x0000 00000 (badeq.go:7)	TEXT	"".g(SB), $8-16
      	0x0000 00000 (badeq.go:7)	SUBQ	$8, SP
      	0x0004 00004 (badeq.go:7)	FUNCDATA	$0, gclocals·23e8278e2b69a3a75fa59b23c49ed6ad(SB)
      	0x0004 00004 (badeq.go:7)	FUNCDATA	$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
      	0x0004 00004 (badeq.go:8)	MOVBLZX	"".a+16(FP), AX
      	0x0009 00009 (badeq.go:8)	MOVB	AL, "".autotmp_0+6(SP)
      	0x000d 00013 (badeq.go:8)	MOVBLZX	"".a+17(FP), AX
      	0x0012 00018 (badeq.go:8)	MOVB	AL, "".autotmp_0+7(SP)
      	0x0016 00022 (badeq.go:8)	MOVB	$0, "".autotmp_1+4(SP)
      	0x001b 00027 (badeq.go:8)	MOVB	$1, "".autotmp_1+4(SP)
      	0x0020 00032 (badeq.go:8)	MOVB	$2, "".autotmp_1+5(SP)
      	0x0025 00037 (badeq.go:8)	MOVBLZX	"".autotmp_0+6(SP), AX
      	0x002a 00042 (badeq.go:8)	MOVBLZX	"".autotmp_1+4(SP), CX
      	0x002f 00047 (badeq.go:8)	CMPB	AL, CL
      	0x0031 00049 (badeq.go:8)	JNE	70
      	0x0033 00051 (badeq.go:8)	MOVBLZX	"".autotmp_0+7(SP), AX
      	0x0038 00056 (badeq.go:8)	CMPB	AL, $2
      	0x003a 00058 (badeq.go:8)	SETEQ	AL
      	0x003d 00061 (badeq.go:8)	MOVB	AL, "".~r1+24(FP)
      	0x0041 00065 (badeq.go:8)	ADDQ	$8, SP
      	0x0045 00069 (badeq.go:8)	RET
      	0x0046 00070 (badeq.go:8)	MOVB	$0, AL
      	0x0048 00072 (badeq.go:8)	JMP	61
      
      SSA after:
      
      "".g t=1 size=32 args=0x10 locals=0x0
      	0x0000 00000 (badeq.go:7)	TEXT	"".g(SB), $0-16
      	0x0000 00000 (badeq.go:7)	NOP
      	0x0000 00000 (badeq.go:7)	NOP
      	0x0000 00000 (badeq.go:7)	FUNCDATA	$0, gclocals·23e8278e2b69a3a75fa59b23c49ed6ad(SB)
      	0x0000 00000 (badeq.go:7)	FUNCDATA	$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
      	0x0000 00000 (badeq.go:8)	MOVBLZX	"".a+8(FP), AX
      	0x0005 00005 (badeq.go:8)	CMPB	AL, $1
      	0x0007 00007 (badeq.go:8)	JNE	25
      	0x0009 00009 (badeq.go:8)	MOVBLZX	"".a+9(FP), CX
      	0x000e 00014 (badeq.go:8)	CMPB	CL, $2
      	0x0011 00017 (badeq.go:8)	SETEQ	AL
      	0x0014 00020 (badeq.go:8)	MOVB	AL, "".~r1+16(FP)
      	0x0018 00024 (badeq.go:8)	RET
      	0x0019 00025 (badeq.go:8)	MOVB	$0, AL
      	0x001b 00027 (badeq.go:8)	JMP	20
      
      
      Change-Id: I120185d58012b7bbcdb1ec01225b5b08d0855d86
      Reviewed-on: https://go-review.googlesource.com/22277
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      0bc94a88
    • Ian Lance Taylor's avatar
      path/filepath: don't return SkipDir at top · 157fc454
      Ian Lance Taylor authored
      If the walker function called on a top-level file returns SkipDir,
      then (before this change) Walk would return SkipDir, which the
      documentation implies will not happen.
      
      Fixes #16280.
      
      Change-Id: I37d63bdcef7af4b56e342b624cf0d4b42e65c297
      Reviewed-on: https://go-review.googlesource.com/24780
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      157fc454
    • Josh Bleecher Snyder's avatar
      cmd/compile/internal/obj/x86: clean up "is leaf?" check · 307de654
      Josh Bleecher Snyder authored
      Minor code cleanup. No functional changes.
      
      Change-Id: I2e631b43b122174302a182a1a286c0f873851ce6
      Reviewed-on: https://go-review.googlesource.com/24813
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      307de654
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj/x86: remove pointless NOPs · 64e15291
      Josh Bleecher Snyder authored
      They are no longer needed by stkcheck.
      
      Fixes #16057
      
      Change-Id: I57cb55de5b7a7a1d31a3da200a3a2d51576b68f5
      Reviewed-on: https://go-review.googlesource.com/26667
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      64e15291
    • Egon Elbre's avatar
      website: recreate 16px and 32px favicon · ef694a01
      Egon Elbre authored
      Recreated original favicon with svg. Note, the rasterizations are hand
      tweaked for crispness and straight export will not give the same results.
      
      Fixes #6938
      
      Change-Id: I9bf7b59028711361c29365b145932d90af419b69
      Reviewed-on: https://go-review.googlesource.com/26850Reviewed-by: default avatarChris Broadfoot <cbro@golang.org>
      ef694a01
    • Cherry Zhang's avatar
      cmd/compile: get MIPS64 SSA working · e71e1fe8
      Cherry Zhang authored
      - implement *, /, %, shifts, Zero, Move.
      - fix mistakes in comparison.
      - fix floating point rounding.
      - handle RetJmp in assembler (which was not handled, as a consequence
        Duff's device was disabled in the old backend.)
      
      all.bash now passes with SSA on.
      
      Updates #16359.
      
      Change-Id: Ia14eed0ed1176b5d800592080c8f53dded7fe73f
      Reviewed-on: https://go-review.googlesource.com/27592Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e71e1fe8
    • Dave Cheney's avatar
      cmd/{asm,compile/internal}: delete dead code · e90ae90b
      Dave Cheney authored
      Delete unused fields, methods, vars, and funcs. Spotted by
      honnef.co/go/unused.
      
      Change-Id: I0e65484bbd916e59369c4018be46f120b469d610
      Reviewed-on: https://go-review.googlesource.com/27731
      Run-TryBot: Dave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      e90ae90b
    • Ian Lance Taylor's avatar
      runtime: remove unused type sigtabtt · f29ec7d7
      Ian Lance Taylor authored
      The type sigtabtt was introduced by an automated tool in
      https://golang.org/cl/167550043. It was the Go version of the C type
      SigTab. However, when the C code using SigTab was converted to Go in
      https://golang.org/cl/168500044 it was rewritten to use a different Go
      type, sigTabT, rather than sigtabtt (the difference being that sigTabT
      uses string where sigtabtt uses *int8 from the C type char*). So this is
      just a dreg from the conversion that was never actually used.
      
      Change-Id: I2ec6eb4b25613bf5e5ad1dbba1f4b5ff20f80f55
      Reviewed-on: https://go-review.googlesource.com/27691
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f29ec7d7
    • Josh Bleecher Snyder's avatar
      cmd/compile: optimize integer "in range" expressions · 62861889
      Josh Bleecher Snyder authored
      Use unsigned comparisons to reduce from
      two comparisons to one for integer "in range"
      checks, such as a <= b && b < c.
      We already do this for bounds checks.
      Extend it to user code.
      
      This is much easier to do in the front end than SSA.
      A back end optimization would be more powerful,
      but this is a good start.
      
      This reduces the power of some of SSA prove
      inferences (#16653), but those regressions appear
      to be rare and not worth holding this CL for.
      
      Fixes #15844.
      Fixes #16697.
      
      strconv benchmarks:
      
      name                          old time/op  new time/op   delta
      Atof64Decimal-8               41.4ns ± 3%   38.9ns ± 2%   -5.89%  (p=0.000 n=24+25)
      Atof64Float-8                 48.5ns ± 0%   46.8ns ± 3%   -3.64%  (p=0.000 n=20+23)
      Atof64FloatExp-8              97.7ns ± 4%   93.5ns ± 1%   -4.25%  (p=0.000 n=25+20)
      Atof64Big-8                    187ns ± 8%    162ns ± 2%  -13.54%  (p=0.000 n=24+22)
      Atof64RandomBits-8             250ns ± 6%    233ns ± 5%   -6.76%  (p=0.000 n=25+25)
      Atof64RandomFloats-8           160ns ± 0%    152ns ± 0%   -5.00%  (p=0.000 n=21+22)
      Atof32Decimal-8               41.1ns ± 1%   38.7ns ± 2%   -5.86%  (p=0.000 n=24+24)
      Atof32Float-8                 46.1ns ± 1%   43.5ns ± 3%   -5.63%  (p=0.000 n=21+24)
      Atof32FloatExp-8               101ns ± 4%    100ns ± 2%   -1.59%  (p=0.000 n=24+23)
      Atof32Random-8                 136ns ± 3%    133ns ± 3%   -2.83%  (p=0.000 n=22+22)
      Atoi-8                        33.8ns ± 3%   30.6ns ± 3%   -9.51%  (p=0.000 n=24+25)
      AtoiNeg-8                     31.6ns ± 3%   29.1ns ± 2%   -8.05%  (p=0.000 n=23+24)
      Atoi64-8                      48.6ns ± 1%   43.8ns ± 1%   -9.81%  (p=0.000 n=20+23)
      Atoi64Neg-8                   47.1ns ± 4%   42.0ns ± 2%  -10.83%  (p=0.000 n=25+25)
      FormatFloatDecimal-8           177ns ± 9%    178ns ± 6%     ~     (p=0.460 n=25+25)
      FormatFloat-8                  282ns ± 6%    282ns ± 3%     ~     (p=0.954 n=25+22)
      FormatFloatExp-8               259ns ± 7%    255ns ± 6%     ~     (p=0.089 n=25+24)
      FormatFloatNegExp-8            253ns ± 6%    254ns ± 6%     ~     (p=0.941 n=25+24)
      FormatFloatBig-8               340ns ± 6%    341ns ± 8%     ~     (p=0.600 n=22+25)
      AppendFloatDecimal-8          79.4ns ± 0%   80.6ns ± 6%     ~     (p=0.861 n=20+25)
      AppendFloat-8                  175ns ± 3%    174ns ± 0%     ~     (p=0.722 n=25+20)
      AppendFloatExp-8               142ns ± 4%    142ns ± 2%     ~     (p=0.948 n=25+24)
      AppendFloatNegExp-8            137ns ± 2%    138ns ± 2%   +0.70%  (p=0.001 n=24+25)
      AppendFloatBig-8               218ns ± 3%    218ns ± 4%     ~     (p=0.596 n=25+25)
      AppendFloatBinaryExp-8        80.0ns ± 4%   78.0ns ± 1%   -2.43%  (p=0.000 n=24+21)
      AppendFloat32Integer-8        82.3ns ± 3%   79.3ns ± 4%   -3.69%  (p=0.000 n=24+25)
      AppendFloat32ExactFraction-8   143ns ± 2%    143ns ± 0%     ~     (p=0.177 n=23+19)
      AppendFloat32Point-8           175ns ± 3%    175ns ± 3%     ~     (p=0.062 n=24+25)
      AppendFloat32Exp-8             139ns ± 2%    137ns ± 4%   -1.05%  (p=0.001 n=24+24)
      AppendFloat32NegExp-8          134ns ± 0%    137ns ± 4%   +2.06%  (p=0.000 n=22+25)
      AppendFloat64Fixed1-8         97.8ns ± 0%   98.6ns ± 3%     ~     (p=0.711 n=20+25)
      AppendFloat64Fixed2-8          110ns ± 3%    110ns ± 5%   -0.45%  (p=0.037 n=24+24)
      AppendFloat64Fixed3-8          102ns ± 3%    102ns ± 3%     ~     (p=0.684 n=24+24)
      AppendFloat64Fixed4-8          112ns ± 3%    110ns ± 0%   -1.43%  (p=0.000 n=25+18)
      FormatInt-8                   3.18µs ± 4%   3.10µs ± 6%   -2.54%  (p=0.001 n=24+25)
      AppendInt-8                   1.81µs ± 5%   1.80µs ± 5%     ~     (p=0.648 n=25+25)
      FormatUint-8                   812ns ± 6%    816ns ± 6%     ~     (p=0.777 n=25+25)
      AppendUint-8                   536ns ± 4%    538ns ± 3%     ~     (p=0.798 n=20+22)
      Quote-8                        605ns ± 6%    602ns ± 9%     ~     (p=0.573 n=25+25)
      QuoteRune-8                   99.5ns ± 8%  100.2ns ± 7%     ~     (p=0.432 n=25+25)
      AppendQuote-8                  361ns ± 3%    363ns ± 4%     ~     (p=0.085 n=25+25)
      AppendQuoteRune-8             23.3ns ± 3%   22.4ns ± 2%   -3.79%  (p=0.000 n=25+24)
      UnquoteEasy-8                  146ns ± 4%    145ns ± 5%     ~     (p=0.112 n=24+24)
      UnquoteHard-8                  804ns ± 6%    771ns ± 6%   -4.10%  (p=0.000 n=25+24)
      
      Change-Id: Ibd384e46e90f1cfa40503c8c6352a54c65b72980
      Reviewed-on: https://go-review.googlesource.com/27652
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      62861889
    • Dave Cheney's avatar
      cmd/link/internal, cmd/internal/obj: introduce ctxt.Logf · d61c07ff
      Dave Cheney authored
      Replace the various calls to Fprintf(ctxt.Bso, ...) with a helper,
      ctxt.Logf. This also addresses the various inconsistent flushing of
      ctxt.Bso.
      
      Because we have two Link structures, add Link.Logf in both places.
      
      Change-Id: I23093f9b9b3bf33089a0ffd7f815f92dcd1a1fa1
      Reviewed-on: https://go-review.googlesource.com/27730Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      d61c07ff
    • Dave Cheney's avatar
      cmd/link/internal/ld: move ld.Cpos to coutbuf.Offset · 5f94ff4c
      Dave Cheney authored
      This change moves the ld.Cpos function to a method on coutbuf. This is
      part of a larger change that makes ld.outbuf look more like a bio.Buf in
      an effort to eventually replace the former with the latter.
      
      Change-Id: I506f7131935a2aa903fa302a0fab0c5be50220fd
      Reviewed-on: https://go-review.googlesource.com/27578
      Run-TryBot: Dave Cheney <dave@cheney.net>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      5f94ff4c
    • Michael Munday's avatar
      runtime: use clock_gettime for time.now() on s390x · 61d5daea
      Michael Munday authored
      This should improve the precision of time.now() from microseconds
      to nanoseconds.
      
      Also, modify runtime.nanotime to keep it consistent with cleanup
      done to time.now.
      
      Updates #11222 for s390x.
      
      Change-Id: I27864115ea1fee7299360d9003cd3a8355f624d3
      Reviewed-on: https://go-review.googlesource.com/27710Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      61d5daea
    • Dave Cheney's avatar
      cmd/internal/*: only call ctx.Bso.Flush when something has been written · 3167ff7c
      Dave Cheney authored
      In many places where ctx.Bso.Flush is used as the target for some debug
      logging, ctx.Bso.Flush is called unconditionally. In the majority of
      cases where debug logging is not enabled, this means Flush is called
      many times when there is nothing to be flushed (it will be called anyway
      when ctx.Bso is eventually closed), sometimes in a loop.
      
      Avoid this by moving the ctx.Bso.Flush call into the same condition
      block as the debug print. This pattern was previously applied
      sporadically.
      
      Change-Id: I0444cb235cc8b9bac51a59b2e44e59872db2be06
      Reviewed-on: https://go-review.googlesource.com/27579
      Run-TryBot: Dave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      3167ff7c
    • Matthew Dempsky's avatar
      cmd/go: refactor cgo logic · 1472221a
      Matthew Dempsky authored
      Extract "cgo -dynimport" and "ld -r" logic into separate helper
      methods to make (*builder).cgo somewhat more manageable.
      
      Fixes #16650.
      
      Change-Id: I3e4d77ff3791528b1233467060d3ea83cb854acb
      Reviewed-on: https://go-review.googlesource.com/27270
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      1472221a
  3. 24 Aug, 2016 9 commits