]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
6 years ago[dev.boringcrypto] all: merge master into dev.boringcrypto
Filippo Valsorda [Fri, 18 May 2018 01:04:07 +0000 (21:04 -0400)]
[dev.boringcrypto] all: merge master into dev.boringcrypto

Conflicts due to simple variable renames (d <-> d0):
    src/crypto/sha1/sha1.go
    src/crypto/sha256/sha256.go
    src/crypto/sha512/sha512.go

Change-Id: I437df180a527fb3ec8b47927ee71960d5d200b76

6 years agoencoding/asn1: allow Marshaling and Unmarshaling private tag class
HAMANO Tsukasa [Wed, 2 May 2018 05:54:12 +0000 (05:54 +0000)]
encoding/asn1: allow Marshaling and Unmarshaling private tag class

ASN.1 has an private class, but current implementation does not support it.

Change-Id: I3ebf07a048831869572f75223cb17d4c115caef7
GitHub-Last-Rev: b3c69ad091218acfa0bb0e34111cceae69586eb9
GitHub-Pull-Request: golang/go#25195
Reviewed-on: https://go-review.googlesource.com/110561
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 years agocmd/link/internal/ld: don't call fieldtrack if it's not enabled
isharipo [Thu, 17 May 2018 16:45:49 +0000 (19:45 +0300)]
cmd/link/internal/ld: don't call fieldtrack if it's not enabled

If go toolchain is not built with GOEXPERIMENT=fieldtrack,
skip fieldtrack pass in the linker as it does full symtab traversal.

For linking "hello world" example from net/http:

name      old time/op  new time/op  delta
Linker-4   530ms ± 2%   525ms ± 2%  -1.03%  (p=0.028 n=17+19)

Fixes #20318
Updates #14624

Change-Id: I99336513db77d13f95f47d27339d76f01c42a5da
Reviewed-on: https://go-review.googlesource.com/113635
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/internal/obj/x86: fix VPERMQ and VPERMPD ytab
isharipo [Thu, 17 May 2018 15:20:53 +0000 (18:20 +0300)]
cmd/internal/obj/x86: fix VPERMQ and VPERMPD ytab

Fixes invalid encoding of VPERMQ and VPERMPD that use
negative immediate argument.

Fixes #25418
Updates #25420

Change-Id: Idd8180c4c632a76b76f3a68efd5f930d94431994
Reviewed-on: https://go-review.googlesource.com/113615
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
6 years agonet: skip external net tests on iOS
Elias Naur [Thu, 17 May 2018 13:20:57 +0000 (15:20 +0200)]
net: skip external net tests on iOS

CL 113095 tried to deflake net tests on iOS by skipping the test
that uses the most sockets. That didn't work well enough and will
be reverted in CL 113555.

The flakes appeared after the iOS exec harness started to forward
environment variables, causing testenv.Builder to be non-empty on
the iOS builder. This CL attempts to fix the flakes with the more
conservative strategy of skipping tests that only run on builders.

The skipped tests happen to be those requiring external network
access; it's plausible that the iOS builder network isn't reliable
enough to run the many parallel DNS lookups and dial outs, while
keeping the number of open file descriptors below the 250 limit.

Change-Id: I9cafdaf2845dd6f3844c4819dcaaaa5970f5da15
Reviewed-on: https://go-review.googlesource.com/113575
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/asm/internal/asm/testdata: convert CRLF to LF line ending
Zhou Peng [Thu, 17 May 2018 13:58:46 +0000 (13:58 +0000)]
cmd/asm/internal/asm/testdata: convert CRLF to LF line ending

Change-Id: Icbff14b52e040826bc6de704942ff2f8e0164e3e
Reviewed-on: https://go-review.googlesource.com/113596
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoRevert "net: skip socket hungry test on iOS"
Elias Naur [Thu, 17 May 2018 13:24:03 +0000 (13:24 +0000)]
Revert "net: skip socket hungry test on iOS"

This reverts commit 3027932ac3d8d943a404e0b6f9d9ea390c8e6840.

Reason for revert: It didn't work well enough; a replacement CL that skips external net tests altogether on iOS is coming.

Change-Id: Ib2c5656cee92bcae744f9c99fbcb9f9f2baa0694
Reviewed-on: https://go-review.googlesource.com/113555
Run-TryBot: Elias Naur <elias.naur@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/vendor/.../pprof: delete pprof.go file
Hana (Hyang-Ah) Kim [Tue, 15 May 2018 17:32:02 +0000 (13:32 -0400)]
cmd/vendor/.../pprof: delete pprof.go file

The file is not used ('go tool' uses cmd/pprof/pprof.go instead)
and the external package import in this file causes test failure.

Fixes #25367

Change-Id: I71fbf8a3631efb1bd9e459b8247e5f7a6683894c
Reviewed-on: https://go-review.googlesource.com/113295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoencoding/base32: handle NoPadding in NewDecoder
Gustav Westling [Wed, 16 May 2018 16:35:58 +0000 (16:35 +0000)]
encoding/base32: handle NoPadding in NewDecoder

This change adds functionality to properly handle NoPadding in NewDecoder.

Removes the following expectations when using NoPadding:

* the input message length is a multiple of 8
* the input message length is 0, or longer than 7 characters

Fixes #25332

Change-Id: I7c38160df23f7e8da4f85a5629530016e7bf71f3
GitHub-Last-Rev: 68ab8d2291df5c69e647620f8ef82cc90e06db28
GitHub-Pull-Request: golang/go#25394
Reviewed-on: https://go-review.googlesource.com/113215
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/dist: add support for disabling test -short mode
Brad Fitzpatrick [Wed, 16 May 2018 19:29:59 +0000 (19:29 +0000)]
cmd/dist: add support for disabling test -short mode

So we can have builders running go test -short=false.

Updates golang/go#12508

Change-Id: If90f0f6d9f89268c33b1d1876139ad551fecd3d8
Reviewed-on: https://go-review.googlesource.com/113435
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/internal/objfile, debug/macho: support disassembling arm64 Mach-O objects
Tobias Klauser [Wed, 16 May 2018 12:13:11 +0000 (14:13 +0200)]
cmd/internal/objfile, debug/macho: support disassembling arm64 Mach-O objects

Fixes #25423

Change-Id: I6bed0726b8f4c7d607a3df271b2ab1006e96fa75
Reviewed-on: https://go-review.googlesource.com/113356
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: use debugSelect flag to toggle debug code
Zhou Peng [Wed, 16 May 2018 12:56:54 +0000 (12:56 +0000)]
runtime: use debugSelect flag to toggle debug code

This block of code once was commented by the original author, but commenting
code looks a little annoying. However, the debugSelect flag is just for the
situation that debug code will be compiled when debuging, when release this
code will be eliminated by the compiler.

Change-Id: I7b94297e368b515116ef44a36058214ddddf9adb
Reviewed-on: https://go-review.googlesource.com/113395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agodoc/contribute.html: remove superfluous article
Tobias Klauser [Wed, 16 May 2018 12:10:02 +0000 (14:10 +0200)]
doc/contribute.html: remove superfluous article

After CL 113016 the "a" article is no longer necessary.

Change-Id: I5a80a210bd2b9eedd73d5f9f3f338d7f22c29ea6
Reviewed-on: https://go-review.googlesource.com/113355
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime/cgo: use size_t in sizeof result comparison
Alberto Donizetti [Wed, 16 May 2018 09:43:02 +0000 (11:43 +0200)]
runtime/cgo: use size_t in sizeof result comparison

When a variable of type int is compared with sizeof's return
value, gcc warns:

  comparison between signed and unsigned integer expressions

Change the type of a couple loop indices that looped over sizeof from
int to size_t to silence the warnings.

Fixes #25411

Change-Id: I2c7858f84237e77945651c7b1b6a75b97edcef65
Reviewed-on: https://go-review.googlesource.com/113335
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc/contribute.html: English cleanups
Rob Pike [Mon, 14 May 2018 09:41:37 +0000 (19:41 +1000)]
doc/contribute.html: English cleanups

Fixes #24487

Change-Id: Ic523e469f7f67f376edd2fca6e07d35bb11b2db9
Reviewed-on: https://go-review.googlesource.com/113016
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: improve error message emitted by debug info generation
Michael Munday [Tue, 15 May 2018 17:22:52 +0000 (18:22 +0100)]
cmd/compile: improve error message emitted by debug info generation

Before:

unexpected at 2721:load with unexpected source op v3278unexpected at 2775:load with
unexpected source op v3281unexpected at 2249:load with unexpected source op
v3289unexpected at 2875:load with unexpected source op v3278unexpected at 2232:load
with unexpected source op v286unexpected at 2231:load with unexpected source op
v3291unexpected at 2784:load with unexpected source op v3289unexpected at 2785:load
with unexpected source op v3291

After:

debug info generation: v2721: load with unexpected source op: Phi (v3278)
debug info generation: v2775: load with unexpected source op: Phi (v3281)
debug info generation: v2249: load with unexpected source op: Phi (v3289)
debug info generation: v2875: load with unexpected source op: Phi (v3278)
debug info generation: v2232: load with unexpected source op: Phi (v286)
debug info generation: v2231: load with unexpected source op: Phi (v3291)
debug info generation: v2784: load with unexpected source op: Phi (v3289)
debug info generation: v2785: load with unexpected source op: Phi (v3291)

Updates #25404.

Change-Id: Ib97722848d27ca18bdcd482a610626bc3c6def7d
Reviewed-on: https://go-review.googlesource.com/113275
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
6 years agovendor/golang_org/x/crypto: revendor
Michael Munday [Mon, 14 May 2018 23:26:36 +0000 (00:26 +0100)]
vendor/golang_org/x/crypto: revendor

This change updates the vendored copy of golang.org/x/crypto to
commit 1a580b3eff7814fc9b40602fd35256c63b50f491.

An import of golang.org/x/sys/cpu was replaced with an import of
internal/cpu as required by
https://github.com/golang/go/issues/24843#issuecomment-383194779.

The following bash command can be used to replicate this import
update:

find `pwd` -name '*.go' -exec sed -i 's/golang\.org\/x\/sys\/cpu/internal\/cpu/g' '{}' \;

Change-Id: Ic80d361f940a96c70e4196f594d791c63421d73c
Reviewed-on: https://go-review.googlesource.com/113175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomime: do a pre-allocation in encodeWord
isharipo [Tue, 15 May 2018 16:09:49 +0000 (19:09 +0300)]
mime: do a pre-allocation in encodeWord

The preallocated memory size is comparable to bytes.Buffer bootstraping
array length (bytes.Buffer was used before rewrite to strings.Builder).

Without preallocation, encodeWord does more than one allocation for
almost any possible input.

The regression happens because bytes.Buffer did a 80-bytes allocation
at the beginning of encodeWord while strings.Builder did several
smaller allocations (started with cap=0).

Comparison with reported regression:

  name           old time/op    new time/op    delta
  QEncodeWord-4     781ns ± 1%     593ns ± 1%  -24.08%  (p=0.008 n=5+5)

  name           old alloc/op   new alloc/op   delta
  QEncodeWord-4      152B ± 0%       80B ± 0%  -47.37%  (p=0.008 n=5+5)

  name           old allocs/op  new allocs/op  delta
  QEncodeWord-4      5.00 ± 0%      2.00 ± 0%  -60.00%  (p=0.008 n=5+5)

Comparison with buffer solution (like before strings.Builder, but
without sync pool for buffer re-using):

  name           old time/op    new time/op    delta
  QEncodeWord-4     595ns ± 1%     593ns ± 1%     ~     (p=0.460 n=5+5)

  name           old alloc/op   new alloc/op   delta
  QEncodeWord-4      160B ± 0%       80B ± 0%  -50.00%  (p=0.008 n=5+5)

  name           old allocs/op  new allocs/op  delta
  QEncodeWord-4      2.00 ± 0%      2.00 ± 0%     ~     (all equal)

We avoid allocation in buf.String(), as expected.

Fixes #25379

Change-Id: I19763f0e593a27390c1a549b86ce6507b489046b
Reviewed-on: https://go-review.googlesource.com/113235
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/wasm: fix passing large negative integers from JS to Go
Richard Musiol [Mon, 14 May 2018 22:52:18 +0000 (00:52 +0200)]
misc/wasm: fix passing large negative integers from JS to Go

This commit addresses a FIXME left in the code of wasm_exec.js to
properly get the upper 32 bit of a JS number to be stored as an
64-bit integer. A bitshift operation is not possible, because in
JavaScript bitshift operations only operate on the lower 32 bits.

Change-Id: I8f627fd604e592682d9d322942a4852db64a7f66
Reviewed-on: https://go-review.googlesource.com/113076
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/wasm: pollute global JS namespace less
Richard Musiol [Wed, 9 May 2018 13:18:59 +0000 (15:18 +0200)]
misc/wasm: pollute global JS namespace less

This commit changes wasm_exec.js so it only puts the single
name "go" into the global namespace. Other names became private
or were turned into a property/method of "go".

Change-Id: I633829dfd3c06936f092c0a14b9978bf855e41fe
Reviewed-on: https://go-review.googlesource.com/112980
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
6 years agonet: skip socket hungry test on iOS
Elias Naur [Mon, 14 May 2018 18:02:22 +0000 (20:02 +0200)]
net: skip socket hungry test on iOS

The iOS builder recently gained access to the GO_BUILDER_NAME
environment variable, which in turn enabled some net tests that
were previously guarded by testenv.Builder() == "". Some such tests
have been disabled because they don't work; others have increased
the pressure on open file descriptors, pushing the low iOS limit of
250.

Since many net tests run with t.Parallel(), the "too many open files"
error hit many different tests, so instead of playing whack-a-mole,
lower the file descriptor demand by skipping the most file
descriptor hungry test, TestTCPSpuriousConnSetupCompletionWithCancel.

Before:

$ GO_BUILDER_NAME=darwin-arm64 GOARCH=arm64 go test -short -v net
...
Socket statistical information:
...
(inet4, stream, default): opened=5245 connected=193 listened=75 accepted=177 closed=5399 openfailed=0 connectfailed=5161 listenfailed=0 acceptfailed=143 closefailed=0
...

After:

$ GO_BUILDER_NAME=darwin-arm64 GOARCH=arm64 go test -short -v net
...
Socket statistical information:
...
(inet4, stream, default): opened=381 connected=194 listened=75 accepted=169 closed=547 openfailed=0 connectfailed=297 listenfailed=0 acceptfailed=134 closefailed=0
...

Fixes #25365 (Hopefully).

Change-Id: I8343de1b687ffb79001a846b1211df7aadd0535b
Reviewed-on: https://go-review.googlesource.com/113095
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
6 years agocmd/compile: skip TestStmtLines on Plan 9
David du Colombier [Mon, 14 May 2018 18:34:34 +0000 (20:34 +0200)]
cmd/compile: skip TestStmtLines on Plan 9

TestStmtLines has been added in CL 102435.
This test is failing on Plan 9 because executables
don't have a DWARF symbol table.

Fixes #25387.

Change-Id: I6ae7cba0e8ad4ab569a29ea8920b7849acfb9846
Reviewed-on: https://go-review.googlesource.com/113115
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/compile: remove now-irrelevant test
David Chase [Mon, 14 May 2018 20:12:59 +0000 (16:12 -0400)]
cmd/compile: remove now-irrelevant test

This test measures "line churn" which was minimized to help
improve the debugger experience.  With proper is_stmt markers,
this is no longer necessary, and it is more accurate (for
profiling) to allow line numbers to vary willy-nilly.

"Debugger experience" is now better measured by
cmd/compile/internal/ssa/debug_test.go

This CL made the obsoleting change:
https://go-review.googlesource.com/c/go/+/102435

Change-Id: I874ab89f3b243b905aaeba7836118f632225a667
Reviewed-on: https://go-review.googlesource.com/113155
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agotesting: allow marking subtest and subbenchmark functions as Helpers
Diogo Pinela [Sun, 22 Apr 2018 21:48:56 +0000 (22:48 +0100)]
testing: allow marking subtest and subbenchmark functions as Helpers

Since subtests and subbenchmarks run in a separate goroutine, and thus
a separate stack, this entails capturing the stack trace at the point
tb.Run is called. The work of getting the file and line information from
this stack is only done when needed, however.

Continuing the search into the parent test also requires temporarily
holding its mutex. Since Run does not hold it while waiting for the
subtest to complete, there should be no risk of a deadlock due to this.

Fixes #24128

Change-Id: If0bb169f3ac96bd48794624e619ade7edb599f83
Reviewed-on: https://go-review.googlesource.com/108658
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
6 years agotesting: only compute b.N once when passed -count > 1
Alberto Donizetti [Wed, 2 May 2018 07:45:40 +0000 (09:45 +0200)]
testing: only compute b.N once when passed -count > 1

When running a benchmark multiple times, instead of re-computing the
value of b.N each time, use the value found by the first run.

For

  go test -bench=. -benchtime 3s -count 2 p_test.go

on the benchmark in the linked issue; before:

  BenchmarkBenchmark-4         500   10180593 ns/op
  --- BENCH: BenchmarkBenchmark-4
     p_test.go:13: single call took 10.111079ms
     p_test.go:13: single call took 1.017298685s
     p_test.go:13: single call took 5.090096124s
  BenchmarkBenchmark-4         500   10182164 ns/op
  --- BENCH: BenchmarkBenchmark-4
     p_test.go:13: single call took 10.098169ms
     p_test.go:13: single call took 1.017712905s
     p_test.go:13: single call took 5.090898517s
  PASS
  ok   command-line-arguments 12.244s

and after:

  BenchmarkBenchmark-4         500   10177076 ns/op
  --- BENCH: BenchmarkBenchmark-4
     p_test.go:13: single call took 10.091301ms
     p_test.go:13: single call took 1.016943125s
     p_test.go:13: single call took 5.088376028s
  BenchmarkBenchmark-4         500   10171497 ns/op
  --- BENCH: BenchmarkBenchmark-4
     p_test.go:13: single call took 10.140245ms
     p_test.go:13: single call took 5.085605921s
  PASS
  ok   command-line-arguments 11.218s

Fixes #23423

Change-Id: Ie66a8c5ac43881eb8741e14105db28745b4d56d3
Reviewed-on: https://go-review.googlesource.com/110775
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: reduce allocations in prove by reusing posets
Giovanni Bajo [Mon, 30 Apr 2018 22:57:57 +0000 (00:57 +0200)]
cmd/compile: reduce allocations in prove by reusing posets

In prove, reuse posets between different functions by storing them
in the per-worker cache.

Allocation count regression caused by prove improvements is down
from 5% to 3% after this CL.

Updates #25179

Change-Id: I6d14003109833d9b3ef5165fdea00aa9c9e952e8
Reviewed-on: https://go-review.googlesource.com/110455
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/compile: improve undo of poset
Giovanni Bajo [Sat, 12 May 2018 20:13:44 +0000 (22:13 +0200)]
cmd/compile: improve undo of poset

prove uses the poset datastructure in a DFS walk, and always undoes
it back to its pristine status. Before this CL, poset's undo of
a new node creation didn't fully deallocate the node, which means
that at the end of prove there was still some allocated memory pending.

This was not a problem until now because the posets used by prove
were discarded after each function, but it would prevent recycling
them between functions (as a followup CL does).

Change-Id: I1c1c99c03fe19ad765395a43958cb256f686765a
Reviewed-on: https://go-review.googlesource.com/112976
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/compile: plumb prologueEnd into DWARF
David Chase [Tue, 1 May 2018 03:52:14 +0000 (23:52 -0400)]
cmd/compile: plumb prologueEnd into DWARF

This marks the first instruction after the prologue for
consumption by debuggers, specifically Delve, who asked
for it.  gdb appears to ignore it, lldb appears to use it.

The bits for end-of-prologue and beginning-of-epilogue
are added to Pos (reducing maximum line number by 4x, to
1048575).  They're added in cmd/internal/obj/<ARCH>.go
(currently x86 only), so the compiler-proper need not
deal with them.

The linker currently does nothing with beginning-of-epilogue,
but the plumbing exists to make it easier in the future.

This also upgrades the line number table to DWARF version 3.

This CL includes a regression in the coverage for
testdata/i22558.gdb-dbg.nexts, this appears to be a gdb
artifact but the fix would be in the preceding CL in the
stack.

Change-Id: I3bda5f46a0ed232d137ad48f65a14835c742c506
Reviewed-on: https://go-review.googlesource.com/110416
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/compile: assign and preserve statement boundaries.
David Chase [Sat, 24 Mar 2018 02:46:06 +0000 (22:46 -0400)]
cmd/compile: assign and preserve statement boundaries.

A new pass run after ssa building (before any other
optimization) identifies the "first" ssa node for each
statement. Other "noise" nodes are tagged as being never
appropriate for a statement boundary (e.g., VarKill, VarDef,
Phi).

Rewrite, deadcode, cse, and nilcheck are modified to move
the statement boundaries forward whenever possible if a
boundary-tagged ssa value is removed; never-boundary nodes
are ignored in this search (some operations involving
constants are also tagged as never-boundary and also ignored
because they are likely to be moved or removed during
optimization).

Code generation treats all nodes except those explicitly
marked as statement boundaries as "not statement" nodes,
and floats statement boundaries to the beginning of each
same-line run of instructions found within a basic block.

Line number html conversion was modified to make statement
boundary nodes a bit more obvious by prepending a "+".

The code in fuse.go that glued together the value slices
of two blocks produced a result that depended on the
former capacities (not lengths) of the two slices.  This
causes differences in the 386 bootstrap, and also can
sometimes put values into an order that does a worse job
of preserving statement boundaries when values are removed.

Portions of two delve tests that had caught problems were
incorporated into ssa/debug_test.go.  There are some
opportunities to do better with optimized code, but the
next-ing is not lying or overly jumpy.

Over 4 CLs, compilebench geomean measured binary size
increase of 3.5% and compile user time increase of 3.8%
(this is after optimization to reuse a sparse map instead
of creating multiple maps.)

This CL worsens the optimized-debugging experience with
Delve; we need to work with the delve team so that
they can use the is_stmt marks that we're emitting now.

The reference output changes from time to time depending
on other changes in the compiler, sometimes better,
sometimes worse.

This CL now includes a test ensuring that 99+% of the lines
in the Go command itself (a handy optimized binary) include
is_stmt markers.

Change-Id: I359c94e06843f1eb41f9da437bd614885aa9644a
Reviewed-on: https://go-review.googlesource.com/102435
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/go: fix TestBuildIDContainsArchModeEnv
Yury Smolsky [Sat, 12 May 2018 12:53:46 +0000 (15:53 +0300)]
cmd/go: fix TestBuildIDContainsArchModeEnv

Changing GOARCH, GOARM, GO386 leads to a stale dependency.

Updates #24436.

Change-Id: I5b5b3fca6401be50fa81fb040bc56356de7555de
Reviewed-on: https://go-review.googlesource.com/112975
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agosync: deflake TestWaitGroupMisuse2
Michael Munday [Sun, 13 May 2018 07:13:56 +0000 (08:13 +0100)]
sync: deflake TestWaitGroupMisuse2

We need to yield to the runtime every now and again to avoid
deadlock. This doesn't show up on most machines because the test
only runs when you have 5 or more CPUs.

Fixes #20072.

Change-Id: Ibf5ed370e919943395f3418487188df0b2be160b
Reviewed-on: https://go-review.googlesource.com/112978
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agopath/filepath: make Abs("") return working directory on Windows
Dmitri Shuralyov [Fri, 13 Apr 2018 21:59:16 +0000 (17:59 -0400)]
path/filepath: make Abs("") return working directory on Windows

The current Abs docs say:

// If the path is not absolute it will be joined with the current
// working directory to turn it into an absolute path.

The empty string is not an absolute path, so the docs suggest that the
empty string should be joined with the current working directory to
turn it into an absolute path. This was already the case on all
platforms other than Windows. Per the decision in issue #24441,
this change makes it work on Windows too.

Since the empty string is not a valid path for the purposes of calling
os.Stat on it, we can't simply add the empty string test case to
absTests, which TestAbs uses. It would error when trying to do:

info, err := os.Stat(path)

I didn't find a good way to modify TestAbs to handle this situation
without significantly complicating its code and compromising the test.
So, a separate test is created for testing Abs on empty string input.

Fixes #24441.

Change-Id: I11d8ae2f6e6e358f3e996372ee2a0449093898d2
Reviewed-on: https://go-review.googlesource.com/112935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agodoc/contribute.html: clean up HTML and formatting
Rob Pike [Mon, 14 May 2018 03:53:08 +0000 (13:53 +1000)]
doc/contribute.html: clean up HTML and formatting

Mostly just formatting and minor cleanup:

- regularize HTML (add </p> etc.)
- remove all errors caught by tidy
- start all sentences on new line for easy editing

Some wording changes, but there will be more to come.
It seemed there were already enough edits to send it out.

Update #24487

Change-Id: I613ce206b1e8e3e522ecb0bbcd2acb11c4ff5bae
Reviewed-on: https://go-review.googlesource.com/113015
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/internal/obj/arm: fix wrong encoding of MUL
Ben Shi [Fri, 11 May 2018 06:19:58 +0000 (06:19 +0000)]
cmd/internal/obj/arm: fix wrong encoding of MUL

The arm assembler incorrectly encodes the following instructions.
"MUL R2, R4" -> 0xe0040492 ("MUL R4, R2, R4")
"MUL R2, R4, R4" -> 0xe0040492 ("MUL R4, R2, R4")

The CL fixes that issue.

fixes #25347

Change-Id: I883716c7bc51c5f64837ae7d81342f94540a58cb
Reviewed-on: https://go-review.googlesource.com/112737
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: unify fetching of locals and arguments maps
Austin Clements [Fri, 27 Apr 2018 01:20:41 +0000 (21:20 -0400)]
runtime: unify fetching of locals and arguments maps

Currently we have two nearly identical copies of the code that fetches
the locals and arguments liveness maps for a frame, plus a third
that's a poor knock-off. Unify these all into a single function.

Change-Id: Ibce7926a0b0e3d23182112da4e25df899579a585
Reviewed-on: https://go-review.googlesource.com/109698
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agonet: implement cancellable lookup on Plan 9
David du Colombier [Sun, 13 May 2018 20:58:31 +0000 (22:58 +0200)]
net: implement cancellable lookup on Plan 9

This change implements cancellable lookup
on Plan 9. The query function has been modified
to return when the ctx.Done channel is closed.

Fixes #25361.

Change-Id: I544b779ceec8d69975bc7363045849c21cbfd59e
Reviewed-on: https://go-review.googlesource.com/112981
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link: writelines should keep is_stmt in sync with what it's writing
Alessandro Arzilli [Sun, 13 May 2018 13:17:40 +0000 (15:17 +0200)]
cmd/link: writelines should keep is_stmt in sync with what it's writing

For all functions but the last one if the function ends on a
non-statement instruction the statement flag in debug_line is changed
but is_stmt is not updated to match.

Change-Id: I03c275c5e261ea672ce4da7baca2458810708326
Reviewed-on: https://go-review.googlesource.com/112979
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/compile: ensure init of memclr happens after growslice in extendslice
Martin Möhrmann [Thu, 10 May 2018 08:10:36 +0000 (10:10 +0200)]
cmd/compile: ensure init of memclr happens after growslice in extendslice

Using the extendslice init node list to add the init nodes for the memclr
call could add init nodes for memclr function before the growslice call
created by extendslice.

As all arguments of the memclr were explicitly set in OAS nodes before
the memclr call this does not change the generated code currently.
./all.bash runs fine when replacing memclr init with nil suggesting there
are currently no additional nodes added to the init of extendslice by
the memclr call.

Add the init nodes for the memclr call directly before the node of the
memclr call to prevent additional future init nodes for function calls
and argument evaluations to be evaluated too early when other compiler
code is added.

passes toolstash -cmp

Updates #21266

Change-Id: I44bd396fe864bfda315175aa1064f9d51c5fb57a
Reviewed-on: https://go-review.googlesource.com/112595
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http/httptest: table-test using named subtests
Pierre Prinetti [Sun, 17 Dec 2017 00:41:29 +0000 (01:41 +0100)]
net/http/httptest: table-test using named subtests

Use Go 1.7 Run method of testing.T to run the table-driven tests into
separate, named subtests. The behaviour of the tests is not modified.

Change-Id: Ia88fa59a3534e79e3f0731e948b5f8a9919b339d
Reviewed-on: https://go-review.googlesource.com/84478
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet: stop multiple sends into single capacity channel in lookupIP
Alex Brainman [Sat, 5 May 2018 07:03:21 +0000 (17:03 +1000)]
net: stop multiple sends into single capacity channel in lookupIP

ch is of size 1, and has only one read. But current code can
write to ch more than once. This makes goroutines that do network
name lookups block forever. Only 500 goroutines are allowed, and
we eventually run out of goroutines.

Rewrite the code to only write into ch once.

Fixes #24178

Change-Id: Ifbd37db377c8b05e69eca24cc9147e7f86f899d8
Reviewed-on: https://go-review.googlesource.com/111718
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomath/rand: clarify documentation for Seed example
Agniva De Sarker [Fri, 11 May 2018 15:21:39 +0000 (20:51 +0530)]
math/rand: clarify documentation for Seed example

Fixes #25325

Change-Id: I101641be99a820722edb7272918e04e8d2e1646c
Reviewed-on: https://go-review.googlesource.com/112775
Reviewed-by: Rob Pike <r@golang.org>
6 years agoruntime: skip GDB tests on Windows
Bryan C. Mills [Fri, 11 May 2018 22:11:51 +0000 (18:11 -0400)]
runtime: skip GDB tests on Windows

Updates #22687.

Change-Id: Iedccd9d2416ae7150cd2febe81c8bc9493d8d65c
Reviewed-on: https://go-review.googlesource.com/112915
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodatabase/sql: add note to Scanner that the database owns values
Daniel Theophanes [Fri, 20 Apr 2018 20:18:09 +0000 (13:18 -0700)]
database/sql: add note to Scanner that the database owns values

It was unclear that users must copy values out of the src value
for value types like []byte.

Fixes #24492

Change-Id: I99ad61e0ad0075b9efc5ee4e0d067f752f91b8fa
Reviewed-on: https://go-review.googlesource.com/108535
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/ios: forward SIGQUIT to the iOS program
Elias Naur [Fri, 11 May 2018 15:46:00 +0000 (17:46 +0200)]
misc/ios: forward SIGQUIT to the iOS program

When running tests that fails to complete within the test timeout,
the go tool sends the test program a SIGQUIT signal to print
backtraces. However, for tests running with an exec wrapper, the
resulting backtraces will come from the exec wrapper process and
not the test program.

Change the iOS exec wrapper to forward SIGQUIT signals to the lldb
python driver and change the driver to forward the signals to the
running test on the device.

Before:

$ GOARCH=arm64 go test forever_test.go
lldb: running program
SIGQUIT: quit
PC=0x10816fe m=0 sigcode=0

goroutine 54 [syscall]:
syscall.Syscall6(0x7, 0x16ab, 0xc000033dfc, 0x0, 0xc000116f30, 0x0, 0x0, 0xc000116f30, 0x0, 0x1328820)
/Users/elias/go-tip/src/syscall/asm_darwin_amd64.s:41 +0x5 fp=0xc000033d48 sp=0xc000033d40 pc=0x10816d5
syscall.wait4(0x16ab, 0xc000033dfc, 0x0, 0xc000116f30, 0x90, 0x1200e00, 0x1)
/Users/elias/go-tip/src/syscall/zsyscall_darwin_amd64.go:34 +0x7b fp=0xc000033dc0 sp=0xc000033d48 pc=0x107e4eb
syscall.Wait4(0x16ab, 0xc000033e4c, 0x0, 0xc000116f30, 0xc0000fd518, 0x0, 0x0)
/Users/elias/go-tip/src/syscall/syscall_bsd.go:129 +0x51 fp=0xc000033e10 sp=0xc000033dc0 pc=0x107b7b1
os.(*Process).wait(0xc00008d440, 0x1095e2e, 0xc0000fd518, 0x0)
/Users/elias/go-tip/src/os/exec_unix.go:38 +0x7b fp=0xc000033e80 sp=0xc000033e10 pc=0x109af2b
os.(*Process).Wait(0xc00008d440, 0xc000033fb0, 0x10, 0x11d1f00)
/Users/elias/go-tip/src/os/exec.go:125 +0x2b fp=0xc000033eb0 sp=0xc000033e80 pc=0x109a47b
os/exec.(*Cmd).Wait(0xc0000b1ce0, 0xc000033f90, 0x11394df)
/Users/elias/go-tip/src/os/exec/exec.go:463 +0x5b fp=0xc000033f28 sp=0xc000033eb0 pc=0x1136f0b
main.startDebugBridge.func1(0xc0000b1ce0, 0xc0000b8ae0, 0xc0000e2a80)
/Users/elias/go-tip/misc/ios/go_darwin_arm_exec.go:314 +0x40 fp=0xc000033fc8 sp=0xc000033f28 pc=0x11a1980
runtime.goexit()
/Users/elias/go-tip/src/runtime/asm_amd64.s:1360 +0x1 fp=0xc000033fd0 sp=0xc000033fc8 pc=0x10565a1
created by main.startDebugBridge
/Users/elias/go-tip/misc/ios/go_darwin_arm_exec.go:313 +0x15f

...

After:

$ GOARCH=arm64 go test forever_test.go
lldb: running program
=== RUN   TestForever
SIGQUIT: quit
PC=0x100144e24 m=0 sigcode=0

...

goroutine 19 [select (no cases)]:
command-line-arguments.TestForever(0x1300b60f0)
/Users/elias/go-tip/src/forever_test.go:6 +0x18
testing.tRunner(0x1300b60f0, 0x100211aa0)
/Users/elias/go-tip/src/testing/testing.go:795 +0xa8
created by testing.(*T).Run
/Users/elias/go-tip/src/testing/testing.go:840 +0x22c

...

Change-Id: I6b3cf1662d07a43ade0530842733b0944bee1ace
Reviewed-on: https://go-review.googlesource.com/112676
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
6 years agodatabase/sql: add additional Stats to DBStats
Daniel Theophanes [Fri, 20 Apr 2018 21:22:18 +0000 (14:22 -0700)]
database/sql: add additional Stats to DBStats

Provide better statistics for the database pool. Add counters
for waiting on the pool and closes. Too much waiting or too many
connection closes could indicate a problem.

Fixes #24683
Fixes #22138

Change-Id: I9e1e32a0487edf41c566b8d9c07cb55e04078fec
Reviewed-on: https://go-review.googlesource.com/108536
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/internal/obj/x86: use named consts for movtab Z-cases
quasilyte [Sat, 14 Apr 2018 09:17:09 +0000 (12:17 +0300)]
cmd/internal/obj/x86: use named consts for movtab Z-cases

Use 0-terminated opbyte sequences for Zlit-like movtabs instead of E=0xff.

movCodeFullPtr is unused (load full ptr is unsupported), but it should
be removed in a separate CL (if removed at all).

Passes toolstash-check.

Change-Id: I28436718d93b017153de0e50e3bcec344ea4ee05
Reviewed-on: https://go-review.googlesource.com/107076
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agoreflect: use 'defined' rather than 'named', use 'embedded' rather than 'anonymous'
Robert Griesemer [Thu, 10 May 2018 22:17:58 +0000 (15:17 -0700)]
reflect: use 'defined' rather than 'named', use 'embedded' rather than 'anonymous'

On the API level this is just an update of the documentation to match
the current spec more closely.

On the implementation side, this is a rename of various unexported names.

For #22005.

Change-Id: Ie5ae32f3b10f003805240efcceab3d0fd373cd51
Reviewed-on: https://go-review.googlesource.com/112717
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agogo/types: adopt spec terminology, use 'embedded' rather then 'anonyous' field
Robert Griesemer [Thu, 10 May 2018 20:33:47 +0000 (13:33 -0700)]
go/types: adopt spec terminology, use 'embedded' rather then 'anonyous' field

Commit f8b4123613a (https://go-review.googlesource.com/35108) adjusted
the spec to uniformly use 'embedded' rather than 'anonymous' for struct
embedded fields. Adjust go/types' internal terminology.

Provide an additional accessor Var.IsEmbedded().

This is essentially a rename of an internal field and adjustments of
documentation.

Change-Id: Icd07aa192bc5df7a2ee103185fa7e9c55e8f1ac3
Reviewed-on: https://go-review.googlesource.com/112716
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 years agodatabase/sql: check for nil connRequest.conn before use
Daniel Theophanes [Sun, 25 Mar 2018 23:58:27 +0000 (16:58 -0700)]
database/sql: check for nil connRequest.conn before use

The connRequest may return a nil conn value. However in a rare
case that is difficult to test for it was being passed to
DB.putConn without a nil check. This was an error as this
made no sense if the driverConn is nil. This also caused
a panic in putConn.

A test for this would be nice, but didn't find a sane
way to test for this condition.

Fixes #24445

Change-Id: I827316e856788a5a3ced913f129bb5869b7bcf68
Reviewed-on: https://go-review.googlesource.com/102477
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: use 'not defined' rather than 'unnamed' in error message
Robert Griesemer [Thu, 10 May 2018 18:20:35 +0000 (11:20 -0700)]
cmd/compile: use 'not defined' rather than 'unnamed' in error message

A receiver type may have an (alias type) name and thus be 'named'
even though the name doesn't refer to a defined type. Adjust the
error message to make this clearer.

Change-Id: I969bf8d1ba3db8820f67f6ecd6d5cfe564c5b80d
Reviewed-on: https://go-review.googlesource.com/112638
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go/internal/work: cache cgo invocations for vet, build modes
Russ Cox [Thu, 19 Apr 2018 01:12:19 +0000 (21:12 -0400)]
cmd/go/internal/work: cache cgo invocations for vet, build modes

Even if we had an up-to-date package binary, we reran cgo anyway if
(1) we needed a header file for buildmode c-archive or c-shared, or
(2) we needed cgo-translated files source files for input to go vet.

Cache those outputs too, so that we can avoid cgo if possible.

Working toward exposing the cgo-generated files in go list.

Change-Id: I339ecace925d2b0adc235a17977ecadb3d636c73
Reviewed-on: https://go-review.googlesource.com/108015
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/go: add support for 'go run pkg' or 'go run .'
Russ Cox [Wed, 25 Apr 2018 17:03:03 +0000 (13:03 -0400)]
cmd/go: add support for 'go run pkg' or 'go run .'

To date, go run has required a list of .go files.
This CL allows in place of that list a single import path
or a directory name or a pattern matching a single patckage.
This allows 'go run pkg' or 'go run dir', most importantly 'go run .'.

The discussion in #22726 gives more motivation.
The basic idea is that you can already run 'go test .'
but if you're developing a command it's pretty awkward
to iterate at the same speed. This lets you do that,
by using 'go run . [args]'.

Fixes #22726.

Change-Id: Ibfc8172a4f752588ad96df0a6b0928e9b61fa27f
Reviewed-on: https://go-review.googlesource.com/109341
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/go: remove import path debugging hooks
Russ Cox [Wed, 25 Apr 2018 13:38:56 +0000 (09:38 -0400)]
cmd/go: remove import path debugging hooks

These are no longer needed.

Change-Id: Ie42a84f2bd24d2f59324bb66551c46e6af60c302
Reviewed-on: https://go-review.googlesource.com/109339
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agonet/http/pprof: fix typo on new index page
Ingo Oeser [Thu, 10 May 2018 17:08:46 +0000 (19:08 +0200)]
net/http/pprof: fix typo on new index page

s/thread/thead/ as this is Table HEAD and not a thread as indicated by
the closing tag an context this apears in.

Change-Id: I3aa0cc95b96c9a594cb5a49713efa22d67e4990c
Reviewed-on: https://go-review.googlesource.com/112675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/ios: update documentation for running iOS programs and tests
Elias Naur [Thu, 10 May 2018 15:38:23 +0000 (17:38 +0200)]
misc/ios: update documentation for running iOS programs and tests

Change-Id: I8e3077ab9c7dff66877ac00dc4600b53c07eb1f8
Reviewed-on: https://go-review.googlesource.com/112655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: fix zero extend after float->int conversion
Keith Randall [Thu, 10 May 2018 17:15:52 +0000 (10:15 -0700)]
cmd/compile: fix zero extend after float->int conversion

Don't do direct loads from argument slots if the sizes don't match.
This prevents us from loading from a float32 using a uint64 load
during expressions like uint64(math.float32Bits(f)) where f is a float32 arg.

Fixes #25322

Change-Id: I3887d76f78c844ba546243e7721d811c3d4a9700
Reviewed-on: https://go-review.googlesource.com/112637
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http/pprof: update the /debug/pprof endpoint
Agniva De Sarker [Wed, 9 May 2018 07:00:43 +0000 (12:30 +0530)]
net/http/pprof: update the /debug/pprof endpoint

- Documented the duration parameter in Profile() to match with Trace().

- Properly handling the error from strconv.ParseInt to match with Trace().

- Updated the profiles tables to include additional handlers exposed from
net/http/pprof. Added a separate section at the bottom to explain what
the profiles are and how to use them.

Fixes #24380

Change-Id: I8b7e100d6826a4feec81f29f918e7a7f7ccc71a0
Reviewed-on: https://go-review.googlesource.com/112495
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
6 years agocmd/compile/internal/ssa: initialize t.UInt in SetTypPtrs()
Lynn Boger [Wed, 9 May 2018 21:35:10 +0000 (17:35 -0400)]
cmd/compile/internal/ssa: initialize t.UInt in SetTypPtrs()

Initialization of t.UInt is missing from SetTypPtrs in config.go,
preventing rules that use it from matching when they should.
This adds the initialization to allow those rules to work.

Updated test/codegen/rotate.go to test for this case, which
appears in math/bits RotateLeft32 and RotateLeft64. There had been
a testcase for this in go 1.10 but that went away when asm_test.go
was removed.

Change-Id: I82fc825ad8364df6fc36a69a1e448214d2e24ed5
Reviewed-on: https://go-review.googlesource.com/112518
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/android: add more information to README
Ben Shi [Wed, 9 May 2018 04:11:12 +0000 (04:11 +0000)]
misc/android: add more information to README

Add more information to misc/android/README for developing
arm and arm64 with an Android environment.

Change-Id: I0c88996b6ab0c41946a2c7e69e9c92ec7bb3be27
Reviewed-on: https://go-review.googlesource.com/112276
Reviewed-by: Elias Naur <elias.naur@gmail.com>
6 years agocmd/internal/obj/wasm: avoid invalid offsets for Load/Store
Richard Musiol [Mon, 7 May 2018 14:18:19 +0000 (16:18 +0200)]
cmd/internal/obj/wasm: avoid invalid offsets for Load/Store

Offsets for Load and Store instructions have type i32. Bad index
expression offsets can cause an offset to be larger than MaxUint32,
which is not allowed. One example for this is the test test/index0.go.

Generate valid code by adding a guard to the responsible rewrite rule.
Also emit a proper error when using such a bad index in assembly code.

Change-Id: Ie90adcbf3ae3861c26680eb81790f28692913ccf
Reviewed-on: https://go-review.googlesource.com/111955
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agoencoding/base32: handle NoPadding when using buffered encoding in Close
Gustav Westling [Wed, 9 May 2018 19:05:46 +0000 (19:05 +0000)]
encoding/base32: handle NoPadding when using buffered encoding in Close

This changes makes encoder.Close aware of how many bytes to write if there
is any data left in the buffer.

Fixes #25295

Change-Id: I4138891359935509cb561c453b8059ba2b9e576b
GitHub-Last-Rev: f374096d2f3cae8635506074f59e1cd440c14844
GitHub-Pull-Request: golang/go#25316
Reviewed-on: https://go-review.googlesource.com/112515
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoencoding/base32: handle surplus padding consistently
Gustav Westling [Wed, 9 May 2018 21:02:14 +0000 (21:02 +0000)]
encoding/base32: handle surplus padding consistently

This changes decoder.Read to always return io.ErrUnexpectedEOF if the input
contains surplus padding or unexpected content. Previously the error could
be io.EOF or io.ErrUnexpectedEOF depending on how the input was chunked.

Fixes #25296

Change-Id: I07c36c35e6c83e795c3991bfe45647a35aa58aa4
GitHub-Last-Rev: 818dfda90b0edf9fc415da4579c5810268c1cdba
GitHub-Pull-Request: golang/go#25319
Reviewed-on: https://go-review.googlesource.com/112516
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: fix the rebuilding stale packages test
Yury Smolsky [Thu, 29 Mar 2018 16:52:31 +0000 (19:52 +0300)]
cmd/go: fix the rebuilding stale packages test

Non-main packages do not depend on the "runtime" package,
but main packages still do. Use a main package in the test.

This change passes the -i flag to the install command
to allow installation of updated dependencies,
and removes "install std" as unnecessary.

https://golang.org/cl/107957 is relevant to fixed test.

Updates #24436

Change-Id: If1845f37581a16ad77e72e50be21010e198bc7c5
Reviewed-on: https://go-review.googlesource.com/103675
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agospec: clarify “Constant expressions” for untyped operands
Bryan C. Mills [Fri, 13 Apr 2018 15:57:13 +0000 (11:57 -0400)]
spec: clarify “Constant expressions” for untyped operands

This change addresses the grammatical complexity described in
https://groups.google.com/forum/#!topic/golang-dev/RmP-LMC3g58.

Change-Id: Ib292b4ca9c880c7c1c8c992e7c033a0f8f951f2c
Reviewed-on: https://go-review.googlesource.com/106855
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
6 years agoencoding/xml: fix valid character range
Artyom Pervukhin [Thu, 26 Apr 2018 13:23:54 +0000 (14:23 +0100)]
encoding/xml: fix valid character range

Section 2.2 of the referenced spec http://www.xml.com/axml/testaxml.htm
defines 0xD7FF as a (sub)range boundary, not 0xDF77.

Fixes #25172

Change-Id: Ic5a3328cd46ef6474b8e93c4a343dcfba0e6511f
Reviewed-on: https://go-review.googlesource.com/109495
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/vendor/.../pprof: update to 520140b6bf47519c766e8380e5f094576347b016
Hana (Hyang-Ah) Kim [Wed, 9 May 2018 01:49:58 +0000 (09:49 +0800)]
cmd/vendor/.../pprof: update to 520140b6bf47519c766e8380e5f094576347b016

Change-Id: If431dfa59496b86f58f2ba2a83ca544a28a2a972
Reviewed-on: https://go-review.googlesource.com/112435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agogo/build, cmd/go: don't expect gccgo to have GOROOT packages
Ian Lance Taylor [Fri, 4 May 2018 22:15:47 +0000 (15:15 -0700)]
go/build, cmd/go: don't expect gccgo to have GOROOT packages

When using gccgo the standard library sources are not available in
GOROOT. Don't expect them to be there. In the gccgo build, use a set
of standard library packages generated at build time.

Change-Id: Id133022604d9b7e778e73e8512f9080c61462fba
Reviewed-on: https://go-review.googlesource.com/111595
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
6 years agocmd/go: force untranslated output when running GCC/clang driver
Ian Lance Taylor [Fri, 4 May 2018 21:32:59 +0000 (14:32 -0700)]
cmd/go: force untranslated output when running GCC/clang driver

When we look for the tool ID to use for a compiler, force untranslated
output so that we can match the literal string "version".

Fixes https://gcc.gnu.org/PR84765

Change-Id: I607df445dbd3c5a7c3a6907601adcb039ac16fc1
Reviewed-on: https://go-review.googlesource.com/111575
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
6 years agocmd/go: fix testsuite for gccgo
Ian Lance Taylor [Wed, 2 May 2018 17:02:41 +0000 (10:02 -0700)]
cmd/go: fix testsuite for gccgo

A number of cmd/go tests can never work with gccgo, for various
different reasons. Skip those tests when using gccgo. Adjust some
other tests to pass when using gccgo. Adjust one test to not skip when
using gccgo, since it does work.

Change-Id: I33b09558581a1e304416cf1c05a96f9526abba0e
Reviewed-on: https://go-review.googlesource.com/110915
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
6 years agocmd/go: for gccgo, don't edit cgo header when using -o
Ian Lance Taylor [Fri, 4 May 2018 22:29:09 +0000 (15:29 -0700)]
cmd/go: for gccgo, don't edit cgo header when using -o

This change was made to the gccgo sources as part of CL 47037.
It is required to make the testcarchive and testcshared tests work.
Otherwise using `go build -mode=c-archive -o libgo.a` will cause the
header file to be named go.h rather than libgo.h.

Change-Id: I2db1d7b0f575368b31273cc01097447a0471efd6
Reviewed-on: https://go-review.googlesource.com/111615
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
6 years agocmd/compile: convert memmove call into Move when arguments are disjoint
Michael Munday [Sun, 29 Apr 2018 14:12:50 +0000 (15:12 +0100)]
cmd/compile: convert memmove call into Move when arguments are disjoint

Move ops can be faster than memmove calls because the number of bytes
to be moved is fixed and they don't incur the overhead of a call.
This change allows memmove to be converted into a Move op when the
arguments are disjoint.

The optimization is only enabled on s390x at the moment, however
other architectures may also benefit from it in the future. The
memmove inlining rule triggers an extra 12 times when compiling the
standard library. It will most likely make more of a difference as the
disjoint function is improved over time (to recognize fresh heap
allocations for example).

Change-Id: I9af570dcfff28257b8e59e0ff584a46d8e248310
Reviewed-on: https://go-review.googlesource.com/110064
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
6 years agomisc/ios: inject the -u device_id option before any other arguments
Elias Naur [Tue, 8 May 2018 20:59:35 +0000 (22:59 +0200)]
misc/ios: inject the -u device_id option before any other arguments

The idevicedebugserverproxy command takes a port number without a
flag, like so:

idevicedebugserverproxy 3222

If the -u <device_id> flag is added afterwards, it is ignored and
the command use an arbitrary device. Instead, always inject the -u
flag before any other idevice command arguments.

While here, also kill any leftover idevicedebugserverproxy instance
previous (failed) runs might have left running.

Change-Id: I0bf06ed1a20ef225abeca183f9ba8f396662d435
Reviewed-on: https://go-review.googlesource.com/112216
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: simplify extendslice and isAppendOfMake
Martin Möhrmann [Sun, 6 May 2018 18:18:52 +0000 (20:18 +0200)]
cmd/compile: simplify extendslice and isAppendOfMake

Change-Id: Ia66361812837dde23aac09e916f058ba509a323c
Reviewed-on: https://go-review.googlesource.com/111737
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
6 years agocmd/vet: assume that no builtin funcs are pure
Daniel Martí [Wed, 9 May 2018 04:11:49 +0000 (11:11 +0700)]
cmd/vet: assume that no builtin funcs are pure

That was the intention with the existing code, but it was buggy; builtin
functions aren't treated as values by types.TypeAndVal. Thus, we should
use the IsBuiltin method instead of IsValue.

Teaching vet what builtin funcs are pure is already being tracked as a
separate issue, #22851.

While at it, also add a test with methods, just to be sure that the
current logic doesn't break with that edge case either.

Fixes #25303.

Change-Id: Ic18402b22cceeabf76641c02f575b194b9a536cc
Reviewed-on: https://go-review.googlesource.com/112177
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agohtml/template: always write untyped nil as JS null
Daniel Martí [Wed, 25 Apr 2018 02:45:53 +0000 (11:45 +0900)]
html/template: always write untyped nil as JS null

text/template recently added support for passing untyped nil as function
call arguments, as those would be mixed up with "missing argument"
values before. See CL 95215.

html/template now needs a small change to adapt to that new possibility.
In particular, when printing values as JS bytes, its code was written
under the assumption that the values would never be untyped nil - that
is, the reflect.Value would always be valid.

Short-circuit indirectToJSONMarshaler on an untyped nil, to avoid the
panic and fall back to the existing " null " output. Before this change
and on 1.10, printing a typed nil and an untyped nil resulted in:

null ""

After this change, one will get:

null null

Fixes #24717.

Change-Id: I03cd10ef64b96e837bacc9ccf4cf25624d80de1c
Reviewed-on: https://go-review.googlesource.com/109215
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime/trace: delete functions replaced by cl/108296
Hana Kim [Tue, 8 May 2018 20:37:59 +0000 (16:37 -0400)]
runtime/trace: delete functions replaced by cl/108296

Change-Id: I9bd4e13aafce14f76606b0f96496f621232c9e37
Reviewed-on: https://go-review.googlesource.com/112198
Reviewed-by: Peter Weinberger <pjw@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agotest: fast GC+concurrency+types verification
Matt Juran [Tue, 13 Feb 2018 20:22:25 +0000 (14:22 -0600)]
test: fast GC+concurrency+types verification

This test runs independent goroutines modifying a comprehensive variety
of local vars to look for garbage collector regressions. This test has
been verified to trigger issue 22781 on the go1.9.2 tag. This test
expands on test/fixedbugs/issue22781.go.

Tests #22781

Change-Id: Id32f8dde7ef650aea1b1b4cf518e6d045537bfdc
Reviewed-on: https://go-review.googlesource.com/93715
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: optimize map-clearing range idiom
Martin Möhrmann [Fri, 27 Apr 2018 19:58:59 +0000 (21:58 +0200)]
cmd/compile: optimize map-clearing range idiom

replace map clears of the form:

        for k := range m {
                delete(m, k)
        }

(where m is map with key type that is reflexive for ==)
with a new runtime function that clears the maps backing
array with a memclr and reinitializes the hmap struct.

Map key types that for example contain floats are not
replaced by this optimization since NaN keys cannot
be deleted from maps using delete.

name                           old time/op  new time/op  delta
GoMapClear/Reflexive/1         92.2ns ± 1%  47.1ns ± 2%  -48.89%  (p=0.000 n=9+9)
GoMapClear/Reflexive/10         108ns ± 1%    48ns ± 2%  -55.68%  (p=0.000 n=10+10)
GoMapClear/Reflexive/100        303ns ± 2%   110ns ± 3%  -63.56%  (p=0.000 n=10+10)
GoMapClear/Reflexive/1000      3.58µs ± 3%  1.23µs ± 2%  -65.49%  (p=0.000 n=9+10)
GoMapClear/Reflexive/10000     28.2µs ± 3%  10.3µs ± 2%  -63.55%  (p=0.000 n=9+10)
GoMapClear/NonReflexive/1       121ns ± 2%   124ns ± 7%     ~     (p=0.097 n=10+10)
GoMapClear/NonReflexive/10      137ns ± 2%   139ns ± 3%   +1.53%  (p=0.033 n=10+10)
GoMapClear/NonReflexive/100     331ns ± 3%   334ns ± 2%     ~     (p=0.342 n=10+10)
GoMapClear/NonReflexive/1000   3.64µs ± 3%  3.64µs ± 2%     ~     (p=0.887 n=9+10)
GoMapClear/NonReflexive/10000  28.1µs ± 2%  28.4µs ± 3%     ~     (p=0.247 n=10+10)

Fixes #20138

Change-Id: I181332a8ef434a4f0d89659f492d8711db3f3213
Reviewed-on: https://go-review.googlesource.com/110055
Reviewed-by: Keith Randall <khr@golang.org>
6 years agodoc/faq: tidy up a couple of nits
Rob Pike [Tue, 8 May 2018 19:51:30 +0000 (05:51 +1000)]
doc/faq: tidy up a couple of nits

The phrase "couple X" is considered colloquial, so make that "a couple of X".
Also move the start of a sentence to a new line in a couple of places
for easier editing, in one place thereby removing two spaces after a period.

Change-Id: If5ef05eb496afc235f8f0134c4e7346375a65181
Reviewed-on: https://go-review.googlesource.com/112176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/trace: handle invalid goid para in /trace
Hana (Hyang-Ah) Kim [Wed, 2 May 2018 00:01:00 +0000 (20:01 -0400)]
cmd/trace: handle invalid goid para in /trace

Change-Id: I1cb7c8b70a5ae16386f6abb577c23d821f7ff7f0
Reviewed-on: https://go-review.googlesource.com/112197
Reviewed-by: Peter Weinberger <pjw@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>

6 years agocmd/trace: skip links for buckets with 0 count
Hana (Hyang-Ah) Kim [Tue, 8 May 2018 18:43:08 +0000 (02:43 +0800)]
cmd/trace: skip links for buckets with 0 count

Change-Id: Ib1c2f7cc8e8f631ed9e74161699332f492d4cb0d
Reviewed-on: https://go-review.googlesource.com/112196
Reviewed-by: Peter Weinberger <pjw@google.com>
6 years agodoc: make front page video respond to layout changes (1/2)
jimmyfrasche [Sun, 22 Apr 2018 22:58:49 +0000 (15:58 -0700)]
doc: make front page video respond to layout changes (1/2)

The videos on the front page are always the same width, regardless of
the viewport width. These changes let the video fill the space given
to its container regardless of layout. It uses the standard hack for
making iframes responsive, but the videos are loaded at random and do
not have uniform aspect ratios so that information is injected into the
DOM using custom properties. If these are not supported, it falls back
to the same layout present before this change.

Note: this change also requires CL 108678 to complete the fix,
though either CL without the other is harmless.

Updates #24997.

Change-Id: I2f93dc21ffe01d99ce0e175e9dd0e3d486fddc9f
Reviewed-on: https://go-review.googlesource.com/108677
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agocmd/compile: rename memory-using operations
Keith Randall [Tue, 8 May 2018 16:11:00 +0000 (09:11 -0700)]
cmd/compile: rename memory-using operations

Some *mem ops are loads, some are stores, some are modifications.
Replace mem->load for the loads.
Replace mem->store for the stores.
Replace mem->modify for the load-modify-stores.

The only semantic change in this CL is to mark
ADD(Q|L)constmodify (which used to be ADD(Q|L)constmem) as
both a read and a write, instead of just a write. This is arguably
a bug fix, but the bug isn't triggerable at the moment, see CL 112157.

Change-Id: Iccb45aea817b606adb2d712ff99b10ee28e4616a
Reviewed-on: https://go-review.googlesource.com/112159
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: remove unnecessary convert ops on 32-bit archs
Keith Randall [Tue, 8 May 2018 15:53:21 +0000 (08:53 -0700)]
cmd/compile: remove unnecessary convert ops on 32-bit archs

Missing rule to fold out Convert ops on 32-bit architectures.

This comes up with expressions like
unsafe.Pointer(uintptr(p) + x)

Change-Id: I429e968e5d1a3e13a386ddd29a08ebb6d7dd938a
Reviewed-on: https://go-review.googlesource.com/112158
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/compile: mark modify ops as both read and write
Keith Randall [Tue, 8 May 2018 15:10:17 +0000 (08:10 -0700)]
cmd/compile: mark modify ops as both read and write

If the modify ops operate on a variable, we should tell the liveness
pass that the variable is still live before the instruction.

This looks like a bug, but I don't think there's any way to trigger
it at the moment. It only matters for pointer-containing values, and
the modify ops don't normally work on pointers. Even when I reach for
unsafe.Pointer tricks, I can't get ADDLmodify to work on pointers, as
there's always a Convert or VarDef preventing the coalescing.

TL;DR I can't figure out a test for this. But we should probably
fix it anyway.

Change-Id: I971c62616dec51a33788b7634e6478e1bfcd6260
Reviewed-on: https://go-review.googlesource.com/112157
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: fix go list -test where C is a dependency.
Paul Jolly [Thu, 3 May 2018 07:42:45 +0000 (08:42 +0100)]
cmd/go: fix go list -test where C is a dependency.

Currently go list -test runtime/cgo fails with an index out of range
error. This appears to be because the updating of import paths that
happens as part of -test doesn't take into account the fact that the
Internal.Imports of a package do not contain "C", whereas the public
Imports do.

Therefore we skip the public Import of "C" if it exists and continue.

Change-Id: I5cdc8968890fa7e5da3e375718606037d3282754
Reviewed-on: https://go-review.googlesource.com/111175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: added missing space to pkg-config errors
Chotepud Teo [Tue, 8 May 2018 17:00:35 +0000 (17:00 +0000)]
cmd/go: added missing space to pkg-config errors

pkg-config errors were missing a space between pkg-config flags and packages
e.g.  pkg-config --cflags --staticsdl2

Fixes #25260

Change-Id: Iacecb697c5782c4822db9eefa1a2e4c4daf91a69
GitHub-Last-Rev: 2adf8576be66e31160c109a79f3853feac293f1b
GitHub-Pull-Request: golang/go#25261
Reviewed-on: https://go-review.googlesource.com/111638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agomath/big: implement Lehmer's extended GCD algorithm
Brian Kessler [Tue, 29 Aug 2017 05:38:39 +0000 (22:38 -0700)]
math/big: implement Lehmer's extended GCD algorithm

Updates #15833

The extended GCD algorithm can be implemented using
Lehmer's algorithm with additional updates for the
cosequences following Algorithm 10.45 from Cohen et al.
"Handbook of Elliptic and Hyperelliptic Curve Cryptography" pp 192.
This brings the speed of the extended GCD calculation within
~2x of the base GCD calculation.  There is a slight degradation in
the non-extended GCD speed for small inputs (1-2 words) due to the
additional code to handle the extended updates.

name                          old time/op    new time/op    delta
GCD10x10/WithoutXY-4             262ns ± 1%     266ns ± 2%     ~     (p=0.333 n=5+5)
GCD10x10/WithXY-4               1.42µs ± 2%    0.74µs ± 3%  -47.90%  (p=0.008 n=5+5)
GCD10x100/WithoutXY-4            520ns ± 2%     539ns ± 1%   +3.81%  (p=0.008 n=5+5)
GCD10x100/WithXY-4              2.32µs ± 1%    1.67µs ± 0%  -27.80%  (p=0.008 n=5+5)
GCD10x1000/WithoutXY-4          1.40µs ± 1%    1.45µs ± 2%   +3.26%  (p=0.016 n=4+5)
GCD10x1000/WithXY-4             4.78µs ± 1%    3.43µs ± 1%  -28.37%  (p=0.008 n=5+5)
GCD10x10000/WithoutXY-4         10.0µs ± 0%    10.2µs ± 3%   +1.80%  (p=0.008 n=5+5)
GCD10x10000/WithXY-4            20.9µs ± 3%    17.9µs ± 1%  -14.20%  (p=0.008 n=5+5)
GCD10x100000/WithoutXY-4        96.8µs ± 0%    96.3µs ± 1%     ~     (p=0.310 n=5+5)
GCD10x100000/WithXY-4            196µs ± 3%     159µs ± 2%  -18.61%  (p=0.008 n=5+5)
GCD100x100/WithoutXY-4          2.53µs ±15%    2.34µs ± 0%   -7.35%  (p=0.008 n=5+5)
GCD100x100/WithXY-4             19.3µs ± 0%     3.9µs ± 1%  -79.58%  (p=0.008 n=5+5)
GCD100x1000/WithoutXY-4         4.23µs ± 0%    4.17µs ± 3%     ~     (p=0.127 n=5+5)
GCD100x1000/WithXY-4            22.8µs ± 1%     7.5µs ±10%  -67.00%  (p=0.008 n=5+5)
GCD100x10000/WithoutXY-4        19.1µs ± 0%    19.0µs ± 0%     ~     (p=0.095 n=5+5)
GCD100x10000/WithXY-4           75.1µs ± 2%    30.5µs ± 2%  -59.38%  (p=0.008 n=5+5)
GCD100x100000/WithoutXY-4        170µs ± 5%     167µs ± 1%     ~     (p=1.000 n=5+5)
GCD100x100000/WithXY-4           542µs ± 2%     267µs ± 2%  -50.79%  (p=0.008 n=5+5)
GCD1000x1000/WithoutXY-4        28.0µs ± 0%    27.1µs ± 0%   -3.29%  (p=0.008 n=5+5)
GCD1000x1000/WithXY-4            329µs ± 0%      42µs ± 1%  -87.12%  (p=0.008 n=5+5)
GCD1000x10000/WithoutXY-4       47.2µs ± 0%    46.4µs ± 0%   -1.65%  (p=0.016 n=5+4)
GCD1000x10000/WithXY-4           607µs ± 9%     123µs ± 1%  -79.70%  (p=0.008 n=5+5)
GCD1000x100000/WithoutXY-4       260µs ±17%     245µs ± 0%     ~     (p=0.056 n=5+5)
GCD1000x100000/WithXY-4         3.64ms ± 1%    0.93ms ± 1%  -74.41%  (p=0.016 n=4+5)
GCD10000x10000/WithoutXY-4       513µs ± 0%     507µs ± 0%   -1.22%  (p=0.008 n=5+5)
GCD10000x10000/WithXY-4         7.44ms ± 1%    1.00ms ± 0%  -86.58%  (p=0.008 n=5+5)
GCD10000x100000/WithoutXY-4     1.23ms ± 0%    1.23ms ± 1%     ~     (p=0.056 n=5+5)
GCD10000x100000/WithXY-4        37.3ms ± 0%     7.3ms ± 1%  -80.45%  (p=0.008 n=5+5)
GCD100000x100000/WithoutXY-4    24.2ms ± 0%    24.2ms ± 0%     ~     (p=0.841 n=5+5)
GCD100000x100000/WithXY-4        505ms ± 1%      56ms ± 1%  -88.92%  (p=0.008 n=5+5)

Change-Id: I25f42ab8c55033acb83cc32bb03c12c1963925e8
Reviewed-on: https://go-review.googlesource.com/78755
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go: add -test to go list usage line
Ian Lance Taylor [Tue, 8 May 2018 17:01:41 +0000 (10:01 -0700)]
cmd/go: add -test to go list usage line

Change-Id: Ia57f0ef1a3bdeb06346e175d67979e2a4512622d
Reviewed-on: https://go-review.googlesource.com/112160
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoplugin: make stub lookup signature match dlopen version
Zhou Peng [Sat, 5 May 2018 13:08:17 +0000 (13:08 +0000)]
plugin: make stub lookup signature match dlopen version

Change-Id: I64958f8f1a935adc07868362975447d0c0033084
Reviewed-on: https://go-review.googlesource.com/111716
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: fix Zero-to-Load forwarding rules
Michael Munday [Tue, 8 May 2018 15:30:48 +0000 (16:30 +0100)]
cmd/compile: fix Zero-to-Load forwarding rules

Avoid using values that do not dominate the block the Zero op is in.
Should fix the SSA check builder.

The additional OffPtr ops inserted by these rules should always be
optimized away when the Load is replaced with a const zero.

Fixes #25288.

Change-Id: I4163b58e60364f77c8a206ba084073a58ca6320a
Reviewed-on: https://go-review.googlesource.com/112136
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/compile: simplify shift lowering on s390x
Michael Munday [Mon, 30 Apr 2018 12:27:50 +0000 (13:27 +0100)]
cmd/compile: simplify shift lowering on s390x

Use conditional moves instead of subtractions with borrow to handle
saturation cases. This allows us to delete the SUBE/SUBEW ops and
associated rules from the SSA backend. Using conditional moves also
means we can detect when shift values are masked so I've added some
new rules to constant fold the relevant comparisons and masking ops.

Also use the new shiftIsBounded() function to avoid generating code
to handle saturation cases where possible.

Updates #25167 for s390x.

Change-Id: Ief9991c91267c9151ce4c5ec07642abb4dcc1c0d
Reviewed-on: https://go-review.googlesource.com/110070
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/ios: retry iOS launch even if no device app path was found
Elias Naur [Tue, 8 May 2018 08:21:09 +0000 (10:21 +0200)]
misc/ios: retry iOS launch even if no device app path was found

Now that the iOS exec wrapper uninstalls any existing test app before
installing a new, looking up the device app path might fail. Before,
the lookup always succeeded (even though the path reported might be
stale).

For the iOS builder.

Change-Id: I5667b6fae15f88745bdee796db219a429a26e203
Reviewed-on: https://go-review.googlesource.com/112075
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
6 years agosyscall: eliminate aliasing of syscall error strings in Plan 9
Richard Miller [Thu, 3 May 2018 10:27:48 +0000 (11:27 +0100)]
syscall: eliminate aliasing of syscall error strings in Plan 9

To avoid allocation between entersyscall and exitsyscall in Plan 9,
syscall error strings retrieved from the OS were being stored in
a shared buffer for each M, leading to overwriting of error strings
by subsequent syscalls, and potential confusion if exitsyscall
switched to a different M.  Instead, the error string is now
retrieved to the G stack and then copied to a new allocated array
after exitsyscall.

A new test TestPlan9Syserr is provided to confirm the correction.

Fixes #13770
Fixes #24921

Change-Id: I013c4a42baae80d03a5b61d828396527189f5551
Reviewed-on: https://go-review.googlesource.com/111195
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>

6 years agodebug/elf: add machine and OSABI constants
Tobias Klauser [Tue, 8 May 2018 12:00:42 +0000 (14:00 +0200)]
debug/elf: add machine and OSABI constants

Provide a complete list of EM_* and ELFOSABI_* constants.

Compiled from the tables at
http://www.sco.com/developers/gabi/latest/ch4.eheader.html
and llvm/BinaryFormat/ELF.h from LLVM.

Change-Id: Ice1e1476076fafdb8bb8af848caec6d80a82c452
Reviewed-on: https://go-review.googlesource.com/112115
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoencoding/binary: returns length of bool slice in intDataSize
Joe Kyo [Tue, 8 May 2018 13:00:36 +0000 (21:00 +0800)]
encoding/binary: returns length of bool slice in intDataSize

intDataSize should return length of bool slice, so functions
Read and Write can use the fast path to process bool slice.

Change-Id: I8cd275e3ffea82024850662d86caca64bd91bf70
Reviewed-on: https://go-review.googlesource.com/112135
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

6 years agocmd/compile: use nodl in zeroResults
Tobias Klauser [Tue, 13 Mar 2018 12:01:36 +0000 (13:01 +0100)]
cmd/compile: use nodl in zeroResults

Use nodl instead of nod to avoid setting and resetting lineo.

Passes toolstash-check.

Updates #19683

Change-Id: I6a47a7ba43a11352767029eced29f08dff8501a2
Reviewed-on: https://go-review.googlesource.com/100335
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
6 years agomath, math/big: add wasm architecture
Richard Musiol [Sun, 4 Mar 2018 11:36:52 +0000 (12:36 +0100)]
math, math/big: add wasm architecture

This commit adds the wasm architecture to the math package.

Updates #18892

Change-Id: I5cc38552a31b193d35fb81ae87600a76b8b9e9b5
Reviewed-on: https://go-review.googlesource.com/106996
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agointernal/bytealg: add wasm architecture
Richard Musiol [Sun, 4 Mar 2018 12:38:57 +0000 (13:38 +0100)]
internal/bytealg: add wasm architecture

This commit adds the wasm architecture to the internal/bytealg package.

Some parts of the assembly code have been extracted from WebAssembly
bytecode generated with Emscripten (which uses musl libc).

Updates #18892

Change-Id: Iba7f7158356b816c9ad03ca9223903a41a024da6
Reviewed-on: https://go-review.googlesource.com/103915
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/compile,test: combine byte loads and stores on ppc64le
Lynn Boger [Thu, 1 Mar 2018 16:40:36 +0000 (11:40 -0500)]
cmd/compile,test: combine byte loads and stores on ppc64le

CL 74410 added rules to combine consecutive byte loads and
stores when the byte order was little endian for ppc64le. This
is the corresponding change for bytes that are in big endian order.
These rules are all intended for a little endian target arch.

This adds new testcases in test/codegen/memcombine.go

Fixes #22496
Updates #24242

Benchmark improvement for encoding/binary:
name                      old time/op    new time/op    delta
ReadSlice1000Int32s-16      11.0µs ± 0%     9.0µs ± 0%  -17.47%  (p=0.029 n=4+4)
ReadStruct-16               2.47µs ± 1%    2.48µs ± 0%   +0.67%  (p=0.114 n=4+4)
ReadInts-16                  642ns ± 1%     630ns ± 1%   -2.02%  (p=0.029 n=4+4)
WriteInts-16                 654ns ± 0%     653ns ± 1%   -0.08%  (p=0.629 n=4+4)
WriteSlice1000Int32s-16     8.75µs ± 0%    8.20µs ± 0%   -6.19%  (p=0.029 n=4+4)
PutUint16-16                1.16ns ± 0%    0.93ns ± 0%  -19.83%  (p=0.029 n=4+4)
PutUint32-16                1.16ns ± 0%    0.93ns ± 0%  -19.83%  (p=0.029 n=4+4)
PutUint64-16                1.85ns ± 0%    0.93ns ± 0%  -49.73%  (p=0.029 n=4+4)
LittleEndianPutUint16-16    1.03ns ± 0%    0.93ns ± 0%   -9.71%  (p=0.029 n=4+4)
LittleEndianPutUint32-16    0.93ns ± 0%    0.93ns ± 0%     ~     (all equal)
LittleEndianPutUint64-16    0.93ns ± 0%    0.93ns ± 0%     ~     (all equal)
PutUvarint32-16             43.0ns ± 0%    43.1ns ± 0%   +0.12%  (p=0.429 n=4+4)
PutUvarint64-16              174ns ± 0%     175ns ± 0%   +0.29%  (p=0.429 n=4+4)

Updates made to functions in gcm.go to enable their matching. An existing
testcase prevents these functions from being replaced by those in encoding/binary
due to import dependencies.

Change-Id: Idb3bd1e6e7b12d86cd828fb29cb095848a3e485a
Reviewed-on: https://go-review.googlesource.com/98136
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>