1. 20 Apr, 2018 7 commits
    • Lynn Boger's avatar
      cmd/compile: generate load without DS relocation for go.string on ppc64le · 30311e88
      Lynn Boger authored
      Due to some recent optimizations related to the compare
      instruction, DS-form load instructions started to be used
      to load 8-byte go.strings. This can cause link time errors
      if the go.string is not aligned to 4 bytes.
      
      For DS-form instructions, the value in the offset field must
      be a multiple of 4. If the offset is known at the time the
      rules are processed, a DS-form load will not be chosen. But for
      go.strings, the offset is not known at that time, but a
      relocation is generated indicating that the linker should fill
      in the DS relocation. When the linker tries to fill in the
      relocation, if the offset is not aligned properly, a link error
      will occur.
      
      To fix this, when loading a go.string using MOVDload, the full
      address of the go.string is generated and loaded into the base
      register. Then the go.string is loaded with a 0 offset field.
      
      Added a testcase that reproduces this problem.
      
      Fixes #24799
      
      Change-Id: I6a154e8e1cba64eae290be0fbcb608b75884ecdd
      Reviewed-on: https://go-review.googlesource.com/107855
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      30311e88
    • Ben Shi's avatar
      cmd/internal/obj/arm64: optimize constant pool for 32-bit constants · be88d117
      Ben Shi authored
      Current assembler encodes "ADD $0xaaaaaaaa, Rx" to "MOVD off(PC), Rtmp"
       + "ADD Rtmp, Rx", and a 64-bit item is stored in the constant pool.
      
      This patch optimizes it to "MOVWU off(PC), Rtmp" + "ADD Rtmp, Rx",
      and a 32-bit item is stored.
      
      The total size of the executable binary go and the library files in
      pkg/linux_arm64 decreased about 3KB by this patch.
      
      Change-Id: Ieb1592f78ef9ed52f5d3ad232d6cdf87d0923de1
      Reviewed-on: https://go-review.googlesource.com/107516Reviewed-by: default avatarWei Xiao <Wei.Xiao@arm.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      be88d117
    • Alberto Donizetti's avatar
      cmd/go: document which vet tests are enabled during go test · 4e6fe713
      Alberto Donizetti authored
      Update #18085
      Fixes #24009
      
      Change-Id: I655ad76284480002f8d49da269be92ded306128b
      Reviewed-on: https://go-review.googlesource.com/107077Reviewed-by: default avatarRob Pike <r@golang.org>
      4e6fe713
    • fanzha02's avatar
      cmd/vendor/golang.org/x/arch: pull updates from x repo · 1f5a0e8c
      fanzha02 authored
      Vendor from golang.org/x/arch repo.  Pull in commits that update
      arm64, arm, ppc64 and x86 directories (the latest commit 9111c30).
      
      Change-Id: I2b4b3ea9662e69bcf0eeee9c6aba0118175524df
      Reviewed-on: https://go-review.googlesource.com/107695
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      1f5a0e8c
    • tengufromsky's avatar
      encoding/json: remove unnecessary if conditions · c2a53b1b
      tengufromsky authored
      Fixes gosimple warning "if err != nil { return err };
      return nil' can be simplified to 'return err"
      
      Change-Id: Ife7f78a3a76ab7802b5561d1afec536e103b504a
      Reviewed-on: https://go-review.googlesource.com/108275Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c2a53b1b
    • fanzha02's avatar
      cmd/internal/obj/arm64: summarize the Go assembly syntax and the GNU syntax mapping rules · 9f10d283
      fanzha02 authored
      The patch rewrites the content of doc.go file. The file describes some
      general rules of the mapping between Go assembly syntax and GNU syntax.
      And it gives some Go assembly examples and corresponding GNU assembly
      examples.
      
      The patch changes the doc.go to use standard doc comment format so that
      the link https://golang.org/cmd/internal/obj/arm64/ can display it.
      
      Assembly document framework is mainly contributed by Eric Fang <Eric.Fang@arm.com>
      Documentation work is contributed by Eric Fang and Fannie Zhang <Fannie.Zhang@arm.com>
      
      Change-Id: I8b3f6d6c6b91afdc2c44602e8f796beea905085e
      Reviewed-on: https://go-review.googlesource.com/102055Reviewed-by: default avatarRob Pike <r@golang.org>
      9f10d283
    • Matthew Dempsky's avatar
      cmd/compile: make generated function code more consistent · 25824c96
      Matthew Dempsky authored
      There are a bunch of places where we generate functions: equality and
      hash functions; method expression and promoted method wrappers; and
      print/delete wrappers for defer/go statements.
      
      This CL brings them in sync by:
      
      1) Always using dclfunc and funcbody. Most were already using this,
      but makepartialcall needed some changes.
      
      2) Removing duplicate types.Markdcl/types.Popdcl calls. These are
      already handled by dclfunc and funcbody.
      
      3) Using structargs (already used by genwrapper) to construct new
      param/result lists from existing types.
      
      4) Always accessing the parameter ONAME nodes through Field.Nname
      instead of poking into the ODCLFIELD. Also, since creating a slice of
      the entire parameter list is common, extract this out into a
      paramNnames helper function.
      
      5) Add a Type.IsVariadic method to simplify identifying variadic
      function types.
      
      Passes toolstash-check -gcflags=-dwarf=false. DWARF output changes
      because using structargs in makepartialcall changes the generated
      parameter names.
      
      Change-Id: I6661d3699afdbe7852ad60db5a4ec6eeb2b696e4
      Reviewed-on: https://go-review.googlesource.com/108216
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      25824c96
  2. 19 Apr, 2018 11 commits
    • Michael Fraenkel's avatar
      net: calling File leaves the socket in nonblocking mode · 60e3ebb9
      Michael Fraenkel authored
      On Unix systems, the underlying socket is no longer forced into blocking
      mode.
      
      Fixes #24942
      
      Change-Id: I3e0c503c72df0844e30a63af298691dedacd1f46
      Reviewed-on: https://go-review.googlesource.com/108297
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      60e3ebb9
    • Jason A. Donenfeld's avatar
      syscall: avoid extra syscall on send/recvmsg on Linux · 68c10286
      Jason A. Donenfeld authored
      By simply rearranging the logic, we avoid the overhead of a superfluous
      call to getsockopt. For, if p is already non empty, there's no point
      in having to check if we need to attach dummy payload. This has
      performance benefits when using send/recvmsg for high speed
      communications.
      
      Change-Id: Id85cff17328ecbf6d09dd52fbeeaa691dbe69b75
      Reviewed-on: https://go-review.googlesource.com/108338Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      68c10286
    • Matthew Dempsky's avatar
      cmd/compile: change exporter.pos to take src.XPos instead of *Node · 1c439e6e
      Matthew Dempsky authored
      This is to allow followup refactorings that will replace
      Field.Nname.Pos with Field.Pos.
      
      Passes toolstash-check.
      
      Change-Id: I1060b6a37c60273892f7af5369809057cff61881
      Reviewed-on: https://go-review.googlesource.com/108215
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      1c439e6e
    • weeellz's avatar
      database/sql: remove unnecessary else conditions · da24c95c
      weeellz authored
      Fixes golint warning about "if block ends with a return statement,
      so drop this else and outdent its block".
      
      Change-Id: Iac4fd324e04e3e3fe3e3933f5e59095041d292c5
      Reviewed-on: https://go-review.googlesource.com/107115Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarDaniel Theophanes <kardianos@gmail.com>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      da24c95c
    • Jakub Čajka's avatar
      cmd/go/internal/work: support pkgconf 1.4 and later · c63e047d
      Jakub Čajka authored
      Fixes #23373
      
      Fix interfacing with latest(1.4+) pkgconf versions, as they have change the
      output format, by extending parsing function splitPkgConfigOutput to accommodate
      more possible fragment escaping formats. Function is based on pkgconfigs own
      implementation at
      https://github.com/pkgconf/pkgconf/blob/master/libpkgconf/argvsplit.c. Along
      with this change test case TestSplitPkgConfigOutput have been expanded. Thanks
      to ignatenko for help on test cases and insights in to the pkgconfig.
      
      Change-Id: I55301bb564b07128d5564ec1454dd247f84a95c3
      Reviewed-on: https://go-review.googlesource.com/86541
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c63e047d
    • Aditya Mukerjee's avatar
      runtime: specify behavior of SetMutexProfileFraction for negative values · 3d8940a9
      Aditya Mukerjee authored
      Change-Id: Ie4da1a515d5405140d742bdcd55f54a73a7f71fe
      Reviewed-on: https://go-review.googlesource.com/108175Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      3d8940a9
    • Ben Shi's avatar
      cmd/compile: optimize ARM64 with register indexed load/store · 34f5f8a5
      Ben Shi authored
      ARM64 supports load/store instructions with a memory operand that
      the address is calculated by base register + index register.
      
      In this CL,
      1. Some rules are added to the compile's ARM64 backend to emit
      such efficient instructions.
      2. A wrong rule of load combination is fixed.
      
      The go1 benchmark does show improvement.
      
      name                     old time/op    new time/op    delta
      BinaryTree17-4              44.5s ± 2%     44.1s ± 1%   -0.81%  (p=0.000 n=28+29)
      Fannkuch11-4                32.7s ± 3%     30.5s ± 0%   -6.79%  (p=0.000 n=30+26)
      FmtFprintfEmpty-4           499ns ± 0%     506ns ± 5%   +1.39%  (p=0.003 n=25+30)
      FmtFprintfString-4         1.07µs ± 0%    1.04µs ± 4%   -3.17%  (p=0.000 n=23+30)
      FmtFprintfInt-4            1.15µs ± 4%    1.13µs ± 0%   -1.55%  (p=0.000 n=30+23)
      FmtFprintfIntInt-4         1.77µs ± 4%    1.74µs ± 0%   -1.71%  (p=0.000 n=30+24)
      FmtFprintfPrefixedInt-4    2.37µs ± 5%    2.12µs ± 0%  -10.56%  (p=0.000 n=30+23)
      FmtFprintfFloat-4          3.03µs ± 1%    3.03µs ± 4%   -0.13%  (p=0.003 n=25+30)
      FmtManyArgs-4              7.38µs ± 1%    7.43µs ± 4%   +0.59%  (p=0.003 n=25+30)
      GobDecode-4                 101ms ± 6%      95ms ± 5%   -5.55%  (p=0.000 n=30+30)
      GobEncode-4                78.0ms ± 4%    78.8ms ± 6%   +1.05%  (p=0.000 n=30+30)
      Gzip-4                      4.25s ± 0%     4.27s ± 4%   +0.45%  (p=0.003 n=24+30)
      Gunzip-4                    428ms ± 1%     420ms ± 0%   -1.88%  (p=0.000 n=23+23)
      HTTPClientServer-4          549µs ± 1%     541µs ± 1%   -1.56%  (p=0.000 n=29+29)
      JSONEncode-4                194ms ± 0%     188ms ± 4%     ~     (p=0.417 n=23+30)
      JSONDecode-4                890ms ± 5%     831ms ± 0%   -6.55%  (p=0.000 n=30+23)
      Mandelbrot200-4            47.3ms ± 2%    46.5ms ± 0%     ~     (p=0.980 n=30+26)
      GoParse-4                  43.1ms ± 6%    43.8ms ± 6%   +1.65%  (p=0.000 n=30+30)
      RegexpMatchEasy0_32-4      1.06µs ± 0%    1.07µs ± 3%     ~     (p=0.092 n=23+30)
      RegexpMatchEasy0_1K-4      5.53µs ± 0%    5.51µs ± 0%   -0.24%  (p=0.000 n=25+25)
      RegexpMatchEasy1_32-4      1.02µs ± 3%    1.01µs ± 0%   -1.27%  (p=0.000 n=30+24)
      RegexpMatchEasy1_1K-4      7.26µs ± 0%    7.33µs ± 0%   +0.95%  (p=0.000 n=23+26)
      RegexpMatchMedium_32-4     1.84µs ± 7%    1.79µs ± 1%     ~     (p=0.333 n=30+23)
      RegexpMatchMedium_1K-4      553µs ± 0%     547µs ± 0%   -1.14%  (p=0.000 n=24+22)
      RegexpMatchHard_32-4       30.8µs ± 1%    30.3µs ± 0%   -1.40%  (p=0.000 n=24+24)
      RegexpMatchHard_1K-4        928µs ± 0%     929µs ± 5%   +0.12%  (p=0.013 n=23+30)
      Revcomp-4                   8.13s ± 4%     6.32s ± 1%  -22.23%  (p=0.000 n=30+23)
      Template-4                  899ms ± 6%     854ms ± 1%   -5.01%  (p=0.000 n=30+24)
      TimeParse-4                4.66µs ± 4%    4.59µs ± 1%   -1.57%  (p=0.000 n=30+23)
      TimeFormat-4               4.58µs ± 0%    4.61µs ± 0%   +0.57%  (p=0.000 n=26+24)
      [Geo mean]                  717µs          698µs        -2.55%
      
      name                     old speed      new speed      delta
      GobDecode-4              7.63MB/s ± 6%  8.08MB/s ± 5%   +5.88%  (p=0.000 n=30+30)
      GobEncode-4              9.85MB/s ± 4%  9.75MB/s ± 6%   -1.04%  (p=0.000 n=30+30)
      Gzip-4                   4.56MB/s ± 0%  4.55MB/s ± 4%   -0.36%  (p=0.003 n=24+30)
      Gunzip-4                 45.3MB/s ± 1%  46.2MB/s ± 0%   +1.92%  (p=0.000 n=23+23)
      JSONEncode-4             10.0MB/s ± 0%  10.4MB/s ± 4%     ~     (p=0.403 n=23+30)
      JSONDecode-4             2.18MB/s ± 5%  2.33MB/s ± 0%   +6.91%  (p=0.000 n=30+23)
      GoParse-4                1.34MB/s ± 5%  1.32MB/s ± 5%   -1.66%  (p=0.000 n=30+30)
      RegexpMatchEasy0_32-4    30.2MB/s ± 0%  29.8MB/s ± 3%     ~     (p=0.099 n=23+30)
      RegexpMatchEasy0_1K-4     185MB/s ± 0%   186MB/s ± 0%   +0.24%  (p=0.000 n=25+25)
      RegexpMatchEasy1_32-4    31.4MB/s ± 3%  31.8MB/s ± 0%   +1.24%  (p=0.000 n=30+24)
      RegexpMatchEasy1_1K-4     141MB/s ± 0%   140MB/s ± 0%   -0.94%  (p=0.000 n=23+26)
      RegexpMatchMedium_32-4    541kB/s ± 6%   560kB/s ± 0%   +3.45%  (p=0.000 n=30+23)
      RegexpMatchMedium_1K-4   1.85MB/s ± 0%  1.87MB/s ± 0%   +1.08%  (p=0.000 n=24+23)
      RegexpMatchHard_32-4     1.04MB/s ± 1%  1.06MB/s ± 1%   +1.48%  (p=0.000 n=24+24)
      RegexpMatchHard_1K-4     1.10MB/s ± 0%  1.10MB/s ± 5%   +0.15%  (p=0.004 n=23+30)
      Revcomp-4                31.3MB/s ± 4%  40.2MB/s ± 1%  +28.52%  (p=0.000 n=30+23)
      Template-4               2.16MB/s ± 6%  2.27MB/s ± 1%   +5.18%  (p=0.000 n=30+24)
      [Geo mean]               7.57MB/s       7.79MB/s        +2.98%
      
      fixes #24907
      
      Change-Id: I94afd0e3f53d62a1cf5e452f3dd6daf61be21785
      Reviewed-on: https://go-review.googlesource.com/107376
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      34f5f8a5
    • Tobias Klauser's avatar
      internal/syscall/windows: convert CRLF line endings · d5a52e70
      Tobias Klauser authored
      CL 99337 introduced a file with CRLF line endings. Convert them to LF
      line endings as in all other Go files.
      
      Change-Id: I68b28fd443f05bebbbd9280d1821c4ccd33a4a8a
      Reviewed-on: https://go-review.googlesource.com/108075
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      d5a52e70
    • Felix Kollmann's avatar
      os: enable symlink creation on Windows 10 · c23afa9d
      Felix Kollmann authored
      Fixes #22874
      
      Change-Id: Ia30fc8df39e88fbc2939a4490c34da8dd5815a94
      GitHub-Last-Rev: 3ba7abcc96ee02837fbfd65c044326c2f1923020
      GitHub-Pull-Request: golang/go#24307
      Reviewed-on: https://go-review.googlesource.com/99337
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      c23afa9d
    • Zheng Dayu's avatar
      text/template: improve comment example in doc · c6bbfbe7
      Zheng Dayu authored
      Make comment example consistent with its description.
      Fixes #24767
      
      Change-Id: Icff54b489040b1ce66c644a21343c6576304cf75
      Reviewed-on: https://go-review.googlesource.com/107663Reviewed-by: default avatarRob Pike <r@golang.org>
      c6bbfbe7
    • Fangming.Fang's avatar
      cmd/asm: add rev64 instruction on ARM64 · 206ed90e
      Fangming.Fang authored
      This change provides VREV64 instruction for AES-GCM implementation.
      
      Change-Id: Icdf278862b03556388586f459964b025c47b8c19
      Reviewed-on: https://go-review.googlesource.com/107696Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      206ed90e
  3. 18 Apr, 2018 14 commits
  4. 17 Apr, 2018 8 commits
    • Matthew Dempsky's avatar
      cmd/compile: cleanup import logic slightly · 94197135
      Matthew Dempsky authored
      Use bio.Reader. Include newline character in the expected string value
      instead of truncating it. Get rid of weird "empty archive" check.
      
      Passes toolstash-check.
      
      Change-Id: I16e42542db4827e6ee3644b9a5540a4a30b9bc41
      Reviewed-on: https://go-review.googlesource.com/107620
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      94197135
    • Ashish Gandhi's avatar
      fmt: make %v doc for compound objects consistent · 86827fd7
      Ashish Gandhi authored
      The documentation for %v behavior for compound objects uses an ellipsis
      to indicate indefinite lenght of elements. This is done for struct
      fields as well as elements of arrays and slices. This adds the missing
      ellipsis for maps.
      
      Change-Id: Ia433387fe189d2daf5095df32085a541458f00a1
      Reviewed-on: https://go-review.googlesource.com/107623Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      86827fd7
    • Matthew Dempsky's avatar
      cmd/compile: use empty package name for runtime/{race,msan} · bf101662
      Matthew Dempsky authored
      These fake imports are just so we can emit build dependencies for the
      linker, so the package name isn't really necessary. Also, the package
      import logic assumes that if we have the name for a package, then
      we've already read some package data for it.
      
      Using the empty string allows the importers to correctly populate it
      the first time these packages are seen in package export data.
      
      Passes toolstash-check.
      
      Change-Id: I047bde297600e9dc07478fccc3f57ccc75ce8ae4
      Reviewed-on: https://go-review.googlesource.com/107619
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      bf101662
    • Matthew Dempsky's avatar
      cmd/compile: remove duplicate build ID from export data · aefd99de
      Matthew Dempsky authored
      This is already written out by printObjHeader in obj.go.
      
      Change-Id: I23e7a3826a6233307bd591021718c4cf143b381c
      Reviewed-on: https://go-review.googlesource.com/107618
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      aefd99de
    • Matthew Dempsky's avatar
      go/internal/gcimporter: extract ChanDir and fake FileSet logic · 4074a67c
      Matthew Dempsky authored
      This code will be useful for the indexed format importer, so break it
      out to be easier to reuse separately.
      
      Change-Id: Ie7e6b2ed89770e1ed9aa1edf11682fe35d6bb373
      Reviewed-on: https://go-review.googlesource.com/107617
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4074a67c
    • Matthew Dempsky's avatar
      go/internal/gcimporter: add unit tests for blank parameter names · 7ba12c16
      Matthew Dempsky authored
      cmd/compile internally rewrites blank return parameters to "~bN". Add
      a test to make sure this isn't exposed via the go/types API.
      
      Change-Id: I319644dc5adf483ed30520fd8e9d88cf5cea9751
      Reviewed-on: https://go-review.googlesource.com/107616
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7ba12c16
    • Michael Fraenkel's avatar
      encoding/json: simplify dominantField · fc215989
      Michael Fraenkel authored
      Fixes #18037
      
      Change-Id: I20e27bcc013b00b726eb348daf5ca86b138ddcc2
      Reviewed-on: https://go-review.googlesource.com/107598
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      fc215989
    • Ilya Tocar's avatar
      compress/flate: optimize huffSym · 4984d843
      Ilya Tocar authored
      By using local variables and assigning them back to decompressor
      at the end of huffSym, we allow compiler to keep them in registers
      and avoid reloading/storing them repeatedly. To archive this,
      moreBits was inlined and specialized to work with local variables.
      Also move EOF error conversion to helper function, to make inlined
      part of moreBits more readable. Together this results in nice speed-up:
      
      name                             old time/op    new time/op    delta
      Decode/Digits/Huffman/1e4-6         278µs ± 1%     240µs ± 2%  -13.72%  (p=0.000 n=10+10)
      Decode/Digits/Huffman/1e5-6        2.38ms ± 1%    2.05ms ± 1%  -14.12%  (p=0.000 n=10+10)
      Decode/Digits/Huffman/1e6-6        23.4ms ± 1%    19.9ms ± 0%  -14.69%  (p=0.000 n=9+9)
      Decode/Digits/Speed/1e4-6           280µs ± 2%     254µs ± 1%   -9.28%  (p=0.000 n=10+9)
      Decode/Digits/Speed/1e5-6          2.53ms ± 1%    2.35ms ± 1%   -7.17%  (p=0.000 n=10+10)
      Decode/Digits/Speed/1e6-6          24.8ms ± 1%    23.0ms ± 1%   -7.22%  (p=0.000 n=10+10)
      Decode/Digits/Default/1e4-6         281µs ± 2%     259µs ± 3%   -8.03%  (p=0.000 n=10+10)
      Decode/Digits/Default/1e5-6        2.45ms ± 1%    2.30ms ± 1%   -6.15%  (p=0.000 n=10+10)
      Decode/Digits/Default/1e6-6        24.1ms ± 1%    22.6ms ± 0%   -6.31%  (p=0.000 n=9+9)
      Decode/Digits/Compression/1e4-6     279µs ± 2%     261µs ± 2%   -6.53%  (p=0.000 n=8+9)
      Decode/Digits/Compression/1e5-6    2.44ms ± 1%    2.30ms ± 1%   -5.72%  (p=0.000 n=10+9)
      Decode/Digits/Compression/1e6-6    24.0ms ± 1%    22.6ms ± 0%   -6.10%  (p=0.000 n=10+9)
      Decode/Twain/Huffman/1e4-6          316µs ± 2%     267µs ± 3%  -15.30%  (p=0.000 n=9+10)
      Decode/Twain/Huffman/1e5-6         2.62ms ± 0%    2.22ms ± 0%  -15.24%  (p=0.000 n=10+10)
      Decode/Twain/Huffman/1e6-6         25.7ms ± 1%    21.8ms ± 0%  -15.19%  (p=0.000 n=10+10)
      Decode/Twain/Speed/1e4-6            290µs ± 1%     264µs ± 2%   -9.17%  (p=0.000 n=9+10)
      Decode/Twain/Speed/1e5-6           2.35ms ± 1%    2.13ms ± 1%   -9.74%  (p=0.000 n=9+10)
      Decode/Twain/Speed/1e6-6           22.9ms ± 0%    20.7ms ± 0%   -9.68%  (p=0.000 n=10+9)
      Decode/Twain/Default/1e4-6          270µs ± 2%     252µs ± 2%   -6.67%  (p=0.000 n=9+10)
      Decode/Twain/Default/1e5-6         2.02ms ± 1%    1.84ms ± 1%   -8.85%  (p=0.000 n=10+10)
      Decode/Twain/Default/1e6-6         19.1ms ± 0%    17.5ms ± 1%   -8.73%  (p=0.000 n=9+10)
      Decode/Twain/Compression/1e4-6      272µs ± 1%     250µs ± 4%   -8.20%  (p=0.000 n=9+10)
      Decode/Twain/Compression/1e5-6     2.01ms ± 0%    1.84ms ± 1%   -8.57%  (p=0.000 n=9+10)
      Decode/Twain/Compression/1e6-6     19.1ms ± 0%    17.4ms ± 1%   -8.75%  (p=0.000 n=9+10)
      
      name                             old speed      new speed      delta
      Decode/Digits/Huffman/1e4-6      35.9MB/s ± 1%  41.7MB/s ± 2%  +15.91%  (p=0.000 n=10+10)
      Decode/Digits/Huffman/1e5-6      41.9MB/s ± 1%  48.8MB/s ± 1%  +16.44%  (p=0.000 n=10+10)
      Decode/Digits/Huffman/1e6-6      42.8MB/s ± 1%  50.2MB/s ± 0%  +17.22%  (p=0.000 n=9+9)
      Decode/Digits/Speed/1e4-6        35.7MB/s ± 2%  39.4MB/s ± 1%  +10.22%  (p=0.000 n=10+9)
      Decode/Digits/Speed/1e5-6        39.6MB/s ± 1%  42.6MB/s ± 1%   +7.73%  (p=0.000 n=10+10)
      Decode/Digits/Speed/1e6-6        40.3MB/s ± 1%  43.4MB/s ± 1%   +7.78%  (p=0.000 n=10+10)
      Decode/Digits/Default/1e4-6      35.6MB/s ± 2%  38.7MB/s ± 2%   +8.74%  (p=0.000 n=10+10)
      Decode/Digits/Default/1e5-6      40.9MB/s ± 1%  43.6MB/s ± 1%   +6.55%  (p=0.000 n=10+10)
      Decode/Digits/Default/1e6-6      41.5MB/s ± 1%  44.3MB/s ± 0%   +6.73%  (p=0.000 n=9+9)
      Decode/Digits/Compression/1e4-6  35.8MB/s ± 2%  38.3MB/s ± 2%   +6.99%  (p=0.000 n=8+9)
      Decode/Digits/Compression/1e5-6  40.9MB/s ± 1%  43.4MB/s ± 1%   +6.07%  (p=0.000 n=10+9)
      Decode/Digits/Compression/1e6-6  41.6MB/s ± 1%  44.3MB/s ± 0%   +6.49%  (p=0.000 n=10+9)
      Decode/Twain/Huffman/1e4-6       31.7MB/s ± 2%  37.4MB/s ± 3%  +18.08%  (p=0.000 n=9+10)
      Decode/Twain/Huffman/1e5-6       38.2MB/s ± 0%  45.0MB/s ± 0%  +17.97%  (p=0.000 n=10+10)
      Decode/Twain/Huffman/1e6-6       38.9MB/s ± 1%  45.9MB/s ± 0%  +17.90%  (p=0.000 n=10+10)
      Decode/Twain/Speed/1e4-6         34.5MB/s ± 1%  38.0MB/s ± 2%  +10.11%  (p=0.000 n=9+10)
      Decode/Twain/Speed/1e5-6         42.5MB/s ± 1%  47.0MB/s ± 1%  +10.79%  (p=0.000 n=9+10)
      Decode/Twain/Speed/1e6-6         43.7MB/s ± 0%  48.3MB/s ± 0%  +10.72%  (p=0.000 n=10+9)
      Decode/Twain/Default/1e4-6       37.1MB/s ± 2%  39.8MB/s ± 2%   +7.15%  (p=0.000 n=9+10)
      Decode/Twain/Default/1e5-6       49.5MB/s ± 1%  54.3MB/s ± 1%   +9.71%  (p=0.000 n=10+10)
      Decode/Twain/Default/1e6-6       52.3MB/s ± 0%  57.3MB/s ± 1%   +9.57%  (p=0.000 n=9+10)
      Decode/Twain/Compression/1e4-6   36.7MB/s ± 1%  40.0MB/s ± 4%   +8.96%  (p=0.000 n=9+10)
      Decode/Twain/Compression/1e5-6   49.8MB/s ± 0%  54.5MB/s ± 1%   +9.38%  (p=0.000 n=9+10)
      Decode/Twain/Compression/1e6-6   52.3MB/s ± 0%  57.3MB/s ± 1%   +9.58%  (p=0.000 n=9+10)
      
      Change-Id: Iabfd285535ddb210f7f48f33317c6463b5532400
      Reviewed-on: https://go-review.googlesource.com/102235
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4984d843