1. 18 Apr, 2018 3 commits
    • Tobias Klauser's avatar
      reflect: define MyBuffer more locally in TestImplicitMapConversion · 47435b1d
      Tobias Klauser authored
      There are no strange messages anymore, so define type MyBuffer in the
      block where it is used.
      
      Change-Id: Ic65b15dc76a40f6f734d9ac2116338502fbb66fd
      Reviewed-on: https://go-review.googlesource.com/107735
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      47435b1d
    • Alex Brainman's avatar
      syscall: introduce Pointer type and use it instead of uintptr · 4869ec00
      Alex Brainman authored
      Some syscall structures used by crypto/x509 have uintptr
      fields that store pointers. These pointers are set with
      a pointer to another Go structure. But the pointers are
      not visible by garbage collector, and GC does not update
      the fields after they were set. So when structure with
      invalid uintptr pointers passed to Windows, we get
      memory corruption.
      
      This CL introduces CertInfo, CertTrustListInfo and
      CertRevocationCrlInfo types. It uses pointers to new types
      instead of uintptr in CertContext, CertSimpleChain and
      CertRevocationInfo.
      
      CertRevocationInfo, CertChainPolicyPara and
      CertChainPolicyStatus types have uintptr field that can
      be pointer to many different things (according to Windows
      API). So this CL introduces Pointer type to be used for
      those cases.
      
      As suggested by Austin Clements.
      
      Fixes #21376
      Updates #24820
      
      Change-Id: If95cd9eee3c69e4cfc35b7b25b1b40c2dc8f0df7
      Reviewed-on: https://go-review.googlesource.com/106275Reviewed-by: 's avatarAustin Clements <austin@google.com>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4869ec00
    • Cherry Zhang's avatar
      cmd/compile: in escape analysis, use element type for OIND of slice · 3042463d
      Cherry Zhang authored
      The escape analysis models the flow of "content" of X with a
      level of "indirection" (OIND node) of X. This content can be
      pointer dereference, or slice/string element. For the latter
      case, the type of the OIND node should be the element type of
      the slice/string. This CL fixes this. In particular, this
      matters when the element type is pointerless, where the data
      flow should not cause any escape.
      
      Fixes #15730.
      
      Change-Id: Iba9f92898681625e7e3ddef76ae65d7cd61c41e0
      Reviewed-on: https://go-review.googlesource.com/107597Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      3042463d
  2. 17 Apr, 2018 17 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: 's 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: 's 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: 's 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: 's 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: 's 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: 's 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: 's 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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      4984d843
    • Tim Cooper's avatar
      encoding/hex: fix Dumper not always closing on Close call · 9db1dd07
      Tim Cooper authored
      Updates #23574
      
      Change-Id: I1b87390679e0817a2f6e4e5938994ea32df87bd7
      Reviewed-on: https://go-review.googlesource.com/107596Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9db1dd07
    • Cherry Zhang's avatar
      cmd/internal/obj/arm, runtime: delete old ARM softfloat code · f83e4212
      Cherry Zhang authored
      CL 106735 changed to the new softfloat support on GOARM=5.
      
      ARM assembly code that uses FP instructions not guarded on GOARM,
      if any, will break. The easiest way to fix is probably to use Go
      implementation on GOARM=5, like
      
      	MOVB	runtime·goarm(SB), R11
      	CMP	$5, R11
      	BEQ	arm5
      	... FP instructions ...
      	RET
      arm5:
      	CALL or JMP to Go implementation
      
      Change-Id: I52fc76fac9c854ebe7c6c856c365fba35d3f560a
      Reviewed-on: https://go-review.googlesource.com/107475
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f83e4212
    • quasilyte's avatar
      cmd/internal/obj/x86: better error msg for offset overflow on AMD64 · 58b18cfd
      quasilyte authored
      Say "offset too large" instead of "invalid instruction" when
      assembling for AMD64. GOARCH=386 already reports error correctly.
      
      Fixed #24871
      
      Change-Id: Iab029307b5c5edbb45f9df4b64c60ecb5f101349
      Reviewed-on: https://go-review.googlesource.com/107116
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      58b18cfd
    • Tobias Klauser's avatar
      debug/elf: enable TestNoSectionOverlaps on *bsd and solaris · 74577678
      Tobias Klauser authored
      cmd/link produces ELF executables on all these geese, so enable
      TestNoSectionOverlaps for them as well. Also add a skip message.
      
      Change-Id: I374651dde3679271ef8c0c375c9cabd1adbca310
      Reviewed-on: https://go-review.googlesource.com/107535
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      74577678
    • Elias Naur's avatar
      Revert "cmd/doc: skip directories like other go tools" · ed68bc59
      Elias Naur authored
      This reverts commit 49e3e436.
      
      Reason for revert: breaks iOS builders and Daniel can't fix for a week.
      
      Change-Id: Ib6ff08de9540d46345dc31e1f820c8555e3de3ca
      Reviewed-on: https://go-review.googlesource.com/107218Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ed68bc59
    • Alberto Donizetti's avatar
      fmt: document that Scan etc. accept 'p' format floats · 9bff5057
      Alberto Donizetti authored
      In the Scan functions documentation, clarify that for float/complex
      literals in scientific notation both decimal (e) and binary (p)
      exponents are accepted.
      
      Fixes #24453
      
      Change-Id: Ic6dcdb0c36e088ffb65177038aff7a57ab56b805
      Reviewed-on: https://go-review.googlesource.com/107416Reviewed-by: 's avatarRob Pike <r@golang.org>
      9bff5057
    • Tim Cooper's avatar
      os/exec: remove "binary" when talking about executables · 155aefe0
      Tim Cooper authored
      The use of binary was incorrect as executable files can also be scripts.
      
      The docs for Error are also reworded. The old docs implied that Error was
      returned when attempting to start an executable, which is not correct: it
      was returned by LookPath when the file was not found or did not have the
      attributes of an executable.
      
      Change-Id: I757a44b16612936df4498b43c45c12e4c14956d2
      Reviewed-on: https://go-review.googlesource.com/90315Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      155aefe0
    • fraenkel's avatar
      testing: failfast fails fast when Fatal called · d0925228
      fraenkel authored
      When a test calls t.Fatal()/t.Fatalf(), only deferred code will execute.
      Increment the failure count as part of a deferred call.
      
      Fixes #24412
      
      Change-Id: Ibb154015fcd3d0fb7739718fdda8c9ad22f9e896
      Reviewed-on: https://go-review.googlesource.com/101035
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      d0925228
    • erifan01's avatar
      math: add a testcase for Mod and Remainder respectively · 6d5ebc70
      erifan01 authored
      One might try to implement the Mod or Remainder function with the expression
      x - TRUNC(x/y + 0.5)*y, but in fact this method is wrong, because the rounding
      of (x/y + 0.5) to initialize the argument of TRUNC may lose too much precision.
      However, the current test cases can not detect this error. This CL adds two
      test cases to prevent people from continuing to do such attempts.
      
      Change-Id: I6690f5cffb21bf8ae06a314b7a45cafff8bcee13
      Reviewed-on: https://go-review.googlesource.com/84275Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      6d5ebc70
  3. 16 Apr, 2018 19 commits
  4. 15 Apr, 2018 1 commit