1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:46:10 -07:00
Commit Graph

41355 Commits

Author SHA1 Message Date
Bryan C. Mills
a1b0af9904 internal/goversion: update to 1.14
In #33848, we propose to use 'go 1.14' in the go.mod file to enable
new default behavior. That means that 'go mod init' needs to start
generating that directive by default, which requires the presence of
the updated version tag in the build environment.

Updates #33848

Change-Id: I9f3b8845fdfd843fd76de32f4b55d8f765d691de
Reviewed-on: https://go-review.googlesource.com/c/go/+/198318
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-01 22:07:45 +00:00
Ariel Mashraki
93a79bbcc0 text/template/parse: remove duplication in peekNonSpace
nextNonSpace has an identical code except the call to
backup at the end.

Change-Id: Iefa5b13950007da38323a800fb6b0ce3d436254b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198277
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-10-01 20:30:37 +00:00
Ariel Mashraki
86cd6c2ee5 text/template/parse: use strings.Builder in Chain and List nodes
This CL is a continuation of 198078. Benchmark output:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         24759165      24516563      -0.98%
BenchmarkVariableString-8     115           115           +0.00%
BenchmarkListString-8         924           680           -26.41%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     3              3              +0.00%
BenchmarkListString-8         14             13             -7.14%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     72            72            +0.00%
BenchmarkListString-8         512           424           -17.19%

Change-Id: I9ec48fe4832437c556a5fa94d4cbf6e29e28d944
Reviewed-on: https://go-review.googlesource.com/c/go/+/198080
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 19:03:51 +00:00
Clément Chigot
09c9bced82 cmd/internal/obj/ppc64: Fix ADUFFxxxx generation on aix/ppc64
ADUFFCOPY and ADUFFZERO instructions weren't handled by rewriteToUseTOC.
These instructions are considered as a simple branch except with -dynlink
where they become an indirect call.

Fixes #34604

Change-Id: I16ca6a152164966fb9cbf792219a8a39aad2b53b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197842
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 18:30:25 +00:00
Nuno Cruces
a49067aab6 net/http: avoid sending unspecified time for directories
Change applies to sendFile.
This is already done for sendContent.

Change-Id: If43d9ab99e6e66a1363b08e0bdcceb57df1f855c
GitHub-Last-Rev: 1c47620a09
GitHub-Pull-Request: golang/go#34631
Reviewed-on: https://go-review.googlesource.com/c/go/+/198139
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 15:27:28 +00:00
Andrew Bonventre
1820cca7d7 Revert "cmd/link: load symbols from .syso in external link mode"
This reverts CL 186417.

Reason for revert: Broke darwin (10_14), linux (ppc), aix (ppc)

Updates #33139

Change-Id: I8bf3c817a96a0e57e45754a097cea7062b2fcdfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/198177
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-01 13:20:16 +00:00
Alex Brainman
af880809d8 cmd/link: MapViewOfFile output file
CL 170738 used mmap for writing most of the output file content.

This change implements similar functionality for Windows.

The output of

compilebench -count=5

command before and after this change

name                      old time/op       new time/op       delta
Template                        254ms ±14%        239ms ±10%    ~     (p=0.222 n=5+5)
Unicode                         119ms ±14%        113ms ±12%    ~     (p=0.421 n=5+5)
GoTypes                         892ms ±23%        850ms ± 1%    ~     (p=0.841 n=5+5)
Compiler                        3.86s ± 2%        3.82s ± 1%    ~     (p=0.222 n=5+5)
SSA                             12.6s ± 1%        12.6s ± 1%    ~     (p=0.095 n=5+5)
Flate                           162ms ±18%        149ms ± 1%  -7.91%  (p=0.016 n=5+5)
GoParser                        199ms ±12%        184ms ± 1%    ~     (p=0.056 n=5+5)
Reflect                         524ms ±13%        507ms ± 3%    ~     (p=0.421 n=5+5)
Tar                             207ms ± 7%        198ms ± 0%  -4.58%  (p=0.016 n=5+4)
XML                             305ms ± 6%        299ms ± 5%    ~     (p=0.690 n=5+5)
LinkCompiler                    1.14s ±11%        1.14s ± 3%    ~     (p=0.222 n=5+5)
ExternalLinkCompiler            2.80s ± 5%        2.92s ±13%    ~     (p=0.222 n=5+5)
LinkWithoutDebugCompiler        727ms ± 2%        750ms ± 7%    ~     (p=0.151 n=5+5)
StdCmd                          44.0s ± 8%        43.3s ± 2%    ~     (p=1.000 n=5+5)

name                      old user-time/op  new user-time/op  delta
Template                        300ms ±27%        259ms ±34%    ~     (p=0.341 n=5+5)
Unicode                         134ms ±51%        144ms ±67%    ~     (p=0.548 n=5+5)
GoTypes                         1.05s ±10%        1.03s ± 6%    ~     (p=0.968 n=5+5)
Compiler                        5.01s ± 3%        4.88s ± 3%    ~     (p=0.286 n=5+5)
SSA                             16.8s ± 1%        16.7s ± 1%  -0.95%  (p=0.008 n=5+5)
Flate                           178ms ±67%        181ms ±38%    ~     (p=0.849 n=5+5)
GoParser                        231ms ±32%        219ms ±21%    ~     (p=0.810 n=5+5)
Reflect                         634ms ±33%        650ms ± 6%    ~     (p=0.135 n=5+5)
Tar                             219ms ±36%        231ms ±19%    ~     (p=0.905 n=5+5)
XML                             378ms ±20%        366ms ±23%    ~     (p=0.913 n=5+5)
LinkCompiler                    1.34s ±15%        1.32s ±10%    ~     (p=0.730 n=5+5)
ExternalLinkCompiler            1.22s ±13%        1.18s ±15%    ~     (p=0.873 n=5+5)
LinkWithoutDebugCompiler        847ms ±13%        841ms ±21%    ~     (p=0.667 n=5+5)

name                      old text-bytes    new text-bytes    delta
HelloSize                       767kB ± 0%        767kB ± 0%    ~     (all equal)
CmdGoSize                      10.6MB ± 0%       10.6MB ± 0%    ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.1kB ± 0%       10.1kB ± 0%    ~     (all equal)
CmdGoSize                       310kB ± 0%        310kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       0.00B             0.00B         ~     (all equal)
CmdGoSize                       0.00B             0.00B         ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.10MB ± 0%       1.10MB ± 0%    ~     (all equal)
CmdGoSize                      14.7MB ± 0%       14.7MB ± 0%    ~     (all equal)

Change-Id: I653f63213b9cc8a4b05f71938e34b5d53b05e3f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196846
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-10-01 08:19:15 +00:00
Ariel Mashraki
4f13a9c5b1 text/template/parse: use strings.Builder in String methods
As mentioned in godoc, strings.Builder is more efficient for
concatenating and building strings.
Running a simple bench test on VariableNode.String() gives:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         25676831      24453285      -4.77%
BenchmarkVariableString-8     296           115           -61.15%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     8              3              -62.50%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     112           72            -35.71%

Change-Id: I13c9340080738fcad1edeed859d33ba608e4b05a
Reviewed-on: https://go-review.googlesource.com/c/go/+/198078
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 07:16:47 +00:00
Shenghou Ma
c1635ad8f0 runtime: fix darwin syscall performance regression
While understanding why syscall.Read is 2x slower on darwin/amd64, I found
out that, contrary to popular belief, the slowdown is not due to the migration
to use libSystem.dylib instead of direct SYSCALLs, i.e., CL 141639 (and #17490),
but due to a subtle change introduced in CL 141639.

Previously, syscall.Read used syscall.Syscall(SYS_READ), whose preamble called
runtime.entersyscall, but after CL 141639, syscall.Read changes to call
runtime.syscall_syscall instead, which in turn calls runtime.entersyscallblock
instead of runtime.entersyscall. And the entire 2x slow down can be attributed
to this change.

I think this is unnecessary as even though syscalls like Read might block, it
does not always block, so there is no need to handoff P proactively for each
Read. Additionally, we have been fine with not handing off P for each Read
prior to Go 1.12, so we probably don't need to change it. This changes restores
the pre-Go 1.12 behavior, where syscall preamble uses runtime.entersyscall,
and we rely on sysmon to take P back from g blocked in syscalls.

Change-Id: If76e97b5a7040cf1c10380a567c4f5baec3121ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/197938
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 04:04:40 +00:00
Andrew Bonventre
e617141b0b cmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2
The new yaml.v2 release broke the longtest builder. Update the expected
data.

Updates #28856

Change-Id: I98ec9e32e55bdb6b26b67e46dc16f34f77c2d40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/198117
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-10-01 02:07:28 +00:00
John Papandriopoulos
5e514b76e2 cmd/link: load symbols from .syso in external link mode
Fix linking with a package having a .syso file in external link mode,
that would otherwise cause an error before executing the external
linker because it can't find symbols that are exported in the said
.syso file.

Fixes #33139

Change-Id: Id3ee737fba1c6f1e37910593dfedf9c84486d398
Reviewed-on: https://go-review.googlesource.com/c/go/+/186417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 00:02:11 +00:00
Rob Pike
27cf81e1b4 text/template: further simplify building the vars list
Followup to https://golang.org/cl/197997

If you know the number of elements, you don't need append at all.
Either use append to grow, or allocate and index. Here we choose
number 2.

Change-Id: Ic58637231789640ff7b293ece04a95a8de7ccf8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/198097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 00:00:02 +00:00
Matthew Dempsky
e76b9e8908 cmd/compile: remove pointer temporaries in walkcompare
When comparing two T-typed values t1 and t2 using the T_eq function,
we used to generate:

    pl := &t1
    pr := &t2
    return T_eq(pl, pr, unsafe.Sizeof(T{}))

This CL changes it to simply generate:

    return T_eq(&t1, &t2, unsafe.Sizeof(T{}))

Surprisingly, this does not pass toolstash. For some reason, it seems
like SSA wasn't able to SSA-ify the pl and pr variables in all cases.

Change-Id: I111fbb068a1741fa169c9922cb8cdb6e21579aa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/197601
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-09-30 23:44:36 +00:00
Matthew Dempsky
ecc2d61798 cmd/compile: remove redundant anylit calls in walkcompare
walkcompare already called walkexpr on n.Left and n.Right, which in
turn calls anylit when appropriate.

Passes toolstash-check.

Change-Id: I6912ac5a42b977c04db9d85cb2e7295e275e083d
Reviewed-on: https://go-review.googlesource.com/c/go/+/197600
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-09-30 23:42:51 +00:00
Pantelis Sampaziotis
f91c850be6 text/template/parse: specify slice capacity in Pipenode.CopyPipe()
The required vars slice capacity is known so it can be specified before appending.

Change-Id: Ifa2fe97602e84198c4d01e5a1b0529f3f65f2df1
GitHub-Last-Rev: a0580df208
GitHub-Pull-Request: golang/go#34613
Reviewed-on: https://go-review.googlesource.com/c/go/+/197997
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-30 21:48:20 +00:00
An Xiao
8e032b917a net: update quotation marks in comment
This change updates the use of quotation marks by replacing `ones' with 'ones'.
Quotation like `this' should not be used any more according to
https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

Change-Id: I58470cdcc207864fbc8ca68ec0e77329bd81dc19
GitHub-Last-Rev: d03c81ebfb
GitHub-Pull-Request: golang/go#33719
Reviewed-on: https://go-review.googlesource.com/c/go/+/190817
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-30 21:46:59 +00:00
chauncyc
cde282dbdd crypto/x509: add IPAddresses to list of template fields used by CreateCertificate
Change-Id: Ifbdf33ee4e413c3edba59b7dbed00ab90698cd35
GitHub-Last-Rev: c3bd33c4cf
GitHub-Pull-Request: golang/go#34277
Reviewed-on: https://go-review.googlesource.com/c/go/+/195157
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-09-30 21:25:36 +00:00
Pantelis Sampaziotis
0adc89aa96 strconv: add Unwrap to custom error types
Updates #30322

This change adds the Unwrap method to NumError. NumError is the only custom error type of the strconv that has a nested exported error.

Change-Id: I8774886348880365a83f72a1d106276def27dffe
GitHub-Last-Rev: 712f3df884
GitHub-Pull-Request: golang/go#34213
Reviewed-on: https://go-review.googlesource.com/c/go/+/194563
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-09-30 21:07:51 +00:00
Tobias Klauser
ba18c7c42d syscall: fix TestGroupCleanupUserNamespace on CentOS
Update the list of expected "id" outputs in
TestGroupCleanupUserNamespace with SELinux context information as used
on CentOS.

Fixes #34547

Change-Id: I426bbe2d04e2039c87490362a1891ec3de6e36e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/197841
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-30 16:12:05 +00:00
Carlo Alberto Ferraris
5f1aeaeb77 math/rand: devirtualize interface call in Read
This allows to inline the common case in which the Source is a
rngSource. On linux/amd64 in a VM:

name        old time/op  new time/op  delta
Read3-4     33.8ns ± 8%  18.5ns ± 8%  -45.38%  (p=0.000 n=10+10)
Read64-4     371ns ± 8%    70ns ± 7%  -81.00%  (p=0.000 n=10+10)
Read1000-4  5.33µs ± 5%  0.86µs ± 3%  -83.85%  (p=0.000 n=9+9)

Change-Id: Ibf47b0e9ecdfe62ffcb66d6a92f191800bdc740e
Reviewed-on: https://go-review.googlesource.com/c/go/+/191539
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-30 15:43:34 +00:00
Richard Musiol
60f271358f syscall/js: add Value.Delete for deleting JavaScript properties
This change adds the method Value.Delete, which implements
JavaScript's "delete" operator for deleting properties.

Fixes #33079.

Change-Id: Ia5b190240bd59daca48094fcbc32f8d0a06f19d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/197840
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-30 14:40:06 +00:00
Julien Schmidt
843fec1c7d database/sql: preallocate list slice in Drivers()
The required slice capacity is already known. Thus, preallocate a slice with the correct capacity before appending to it.

Change-Id: I45ac2c5f1701caeb3dda20451d371713ae7e7365
GitHub-Last-Rev: 2bf575be65
GitHub-Pull-Request: golang/go#34602
Reviewed-on: https://go-review.googlesource.com/c/go/+/197917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-30 00:45:38 +00:00
Carlo Alberto Ferraris
931365763a math/rand: devirtualize interface in lockedSource
Avoid interface calls, enable inlining, and store the rngSource close to the
Mutex to exploit better memory locality.

Also add a benchmark to properly measure the threadsafe nature of globalRand.

On a linux/amd64 VM:

name                       old time/op  new time/op  delta
Int63Threadsafe-4          36.4ns ±12%  20.6ns ±11%  -43.52%  (p=0.000 n=30+30)
Int63ThreadsafeParallel-4  79.3ns ± 5%  56.5ns ± 5%  -28.69%  (p=0.000 n=29+30)

Change-Id: I6ab912c1a1e9afc7bacd8e72c82d4d50d546a510
Reviewed-on: https://go-review.googlesource.com/c/go/+/191538
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-29 14:27:05 +00:00
Richard Musiol
57662b1575 cmd/link: add producer section to wasm binaries
This change adds an optional "producer" section that reports the source
language and compiler version. See
https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md.

It also removes the now redundant "go.version" section.

Fixes #33295.

Change-Id: Ib4c80528728caf9e524fbd3f26822cbbc8b05a75
Reviewed-on: https://go-review.googlesource.com/c/go/+/196804
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-29 09:13:13 +00:00
Alberto Donizetti
c19b7b23e5 doc: remove double mention of custom workspace
In the GOPATH section of the 'How To Write Go Code' document, it is
mentioned two times in the span of a few lines that one can set GOPATH
to a custom workspace path. The two paragraphs say basically the same
thing, and they both link to golang.org/wiki/SettingGOPATH, so I'm
quite sure the duplication is not intentional.

This change deletes the second occurrence.

Change-Id: I16f8bb8657041a23ed272eacf9adbc5637e8e34a
Reviewed-on: https://go-review.googlesource.com/c/go/+/197839
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-09-29 07:57:04 +00:00
Alberto Donizetti
2c47caa900 cmd/compile: use %v for Node formatting
CL 197817 replaced a use of n.Rlist with n.Right in a Fprintf call,
but it left the corresponding format as %.v, which broke the
TestFormats test on the longtest builder.

Since with n.Right is custom to use %v (and not %.v), replace the
format with %v.

Fixes the longtest builder.

Change-Id: Icf5bf820a936c51e633c25ada1a71a1ffb6d28c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/197837
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-09-28 13:50:34 +00:00
Mohit Verma
c729116332 cmd/compile: use Node.Right for OAS2* nodes (cleanup)
This CL changes cmd/compile to use Node.Right instead of
Node.Rlist for OAS2FUNC/OAS2RECV/OAS2MAPR/OAS2DOTTYPE nodes.
Fixes #32293

Change-Id: I4c9d9100be2d98d15e016797f934f64d385f5faa
Reviewed-on: https://go-review.googlesource.com/c/go/+/197817
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-09-28 05:04:49 +00:00
Pantelis Sampaziotis
9748e64fe5 regexp: add examples for FindSubmatchIndex and Longest
updates #21450

Change-Id: Ibffe0dadc1e1523c55cd5f5b8a69bc1c399a255d
GitHub-Last-Rev: 507f555081
GitHub-Pull-Request: golang/go#33497
Reviewed-on: https://go-review.googlesource.com/c/go/+/189177
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-28 00:37:35 +00:00
David Crawshaw
2d1c033259 reflect: let StructOf define unexported fields
This was missing from the original StructOf CL because I couldn't
think of a use for it. Now I can: even with types used entirely
by reflect, unexported fields can be set using UnsafeAddr.

Change-Id: I5e7e3d81d16e8817cdd69d85796ce33930ef523b
Reviewed-on: https://go-review.googlesource.com/c/go/+/85661
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-28 00:19:19 +00:00
Hasit Bhatt
739bf6b929 cmd: update x/tools version to enforce only one %w
As mentioned in https://golang.org/issue/34062#issuecomment-529692313
src/cmd refers to older version of golang.org/x/tools.
Hence, not checking if multiple errors are used in the same fmt.Errorf.
Updating golang.org/x/tools version to latest in src/cmd.

Fixes #34062

Change-Id: I358dec2c3d3af2b19add766b8488b919109b81d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/196843
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-09-27 21:17:15 +00:00
Daniel Martí
bdf0fe5448 cmd/compile: minor simplifications in rulegen
First, be consistent about declaring typ as &b.Func.Config.Types and
not &config.Types. Not particularly better, and it barely changes the
output, but we're more consistent now.

Second, remove a bit of duplication when handling the typ, auxint, and
aux variables.

Third and last, remove a stray canFail assignment; we ended up setting
that in add, not breakf, so it's not necessary to set it manually if we
don't use breakf.

Updates #33644.

Change-Id: I75999cb223a201969266fbfeae043599fa27fac5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196803
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 18:58:08 +00:00
Matthew Dempsky
95b8cbfee9 cmd/compile: add column details to export data
This CL updates the export data format to include column details when
writing out position data. cmd/compile is updated to generate and make
use of the new details, but go/internal/gcimporter only knows how to
read the data. It doesn't yet actually make use of it.

Experimentally across a wide range of packages, this increases export
data size by around 4%. However, it has no impact on binary size.
(Notably, it actually shrinks k8s.io/kubernetes/cmd/kubelet's binary
size by 24kB, but it's unclear to me why at this time.)

Updates #28259.

Change-Id: I351fb340839df8d3adced49b3757c4537fb91b3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/196963
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-09-27 18:38:37 +00:00
Justin Nuß
683ef8c844 html/template: document handling of namespaced and data- attributes
Attributes with a namespace or a data- prefix are handled as if they
had no namespace/data- prefix.

There is also a special case, where attributes with a "xmlns" namespace
are always treated as containing URLs.

This could surprise users of the package, since this behaviour was not
documented anywhere, so this change adds some documentation for all
three cases.

Fixes #12648

Change-Id: If57a2ec49fec91a330fc04795726e8cffa9b75c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/79895
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-27 17:59:33 +00:00
Bryan C. Mills
db87c9f2d0 cmd/go: do not reject internal double-dots in path elements
The relative path element ".." is already rejected
by the checks for leading and trailing dots.

Fixes #27299

Change-Id: Ia8ab543c93288cdc0615abd6d22521d44bc56d72
Reviewed-on: https://go-review.googlesource.com/c/go/+/197720
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 17:28:24 +00:00
Emmanuel T Odeke
55738850c4 net/http: remove TestTimeoutHandlerAndFlusher due to flakes
Removes TestTimeoutHandlerAndFlusher due to flakes on
one of the builders due to timing issues.

Perhaps later, we might need to bring it back when we've
figured out the timing issues.

Fixes #34573.

Change-Id: Ia88d4da31fb228296144dc31f9a4288167fb4a53
Reviewed-on: https://go-review.googlesource.com/c/go/+/197757
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 15:38:16 +00:00
Than McIntosh
70a1efbb5c cmd/link: remove reading/processing of function Autom records
Remove linker reading and processing of automs (no longer needed, now
that the compiler is emitting R_USETYPE relocations on functions). So
as to avoid changing the object file format, the object still contains
a count of automs, but this count is required to be zero.

Updates #34554.

Change-Id: I10230e191057c5c5705541eeb06f747d5f73c42d
Reviewed-on: https://go-review.googlesource.com/c/go/+/197500
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:59:05 +00:00
Than McIntosh
cdd59205c4 cmd/compile: don't emit autom's into object file
Don't write Autom records when writing a function to the object file;
we no longer need them in the linker for DWARF processing. So as to
keep the object file format unchanged, write out a zero-length list of
automs to the object, as opposed to removing all references.

Updates #34554.

Change-Id: I42a1d67207ea7114ae4f3a315cf37effba57f190
Reviewed-on: https://go-review.googlesource.com/c/go/+/197499
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:58:59 +00:00
Than McIntosh
e72f002ed0 cmd/link: create DWARF types for autos based R_USETYPE relocs
Switch the linker over to use dummy R_USETYPE relocations on DWARF
subprogram DIEs as a means of insuring that DWARF types are created
for types of autotmp values used in live functions.

This change is part of a series intended to clean up handling of
autotmp types and remove use of autom's in the compiler and linker.

Updates #34554.

Change-Id: Ic74da6bd723ab7e4d8a16ad46e23228650d4b525
Reviewed-on: https://go-review.googlesource.com/c/go/+/197498
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:56:45 +00:00
Than McIntosh
0b486d2a87 cmd/compile: add R_USETYPE relocs to func syms for autom types
During DWARF processing, keep track of the go type symbols for types
directly or indirectly referenced by auto variables in a function,
and add a set of dummy R_USETYPE relocations to the function's DWARF
subprogram DIE symbol.

This change is not useful on its own, but is part of a series of
changes intended to clean up handling of autom's in the compiler
and linker.

Updates #34554.

Change-Id: I974afa9b7092aa5dba808f74e00aa931249d6fe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197497
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:56:32 +00:00
Matthew Dempsky
ac1d440ea6 cmd/compile: apply constant folding to ORUNESTR
ORUNESTR represents the special case of integer->string conversion. If
the integer is a constant, then the string is a constant too, so
evconst needs to perform constant folding here.

Passes toolstash-check.

Fixes #34563.

Change-Id: Ieab3d76794d8ce570106b6b707a4bcd725d156e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197677
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26 23:54:29 +00:00
Giovanni Bajo
0a5116493c cmd/compile: in poset, simplify usage of CheckIntegrity
Instead of returning an error, just panic: the function is
used only for debugging purposes anyway.

Change-Id: Ie81b2309daaf1efb9470992391534bce2141b3c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/196779
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 21:24:48 +00:00
Giovanni Bajo
490646e476 cmd/compile: in poset, move all constants to the first DAG
In poset, all constants are always related to each other, so they
are part of the same DAG. Currently, it can be any of the DAGs in
the forest. Since we're about to start visiting that DAG for the
task of calculating bounds, make sure that it's conventionally
always the first, so that we don't need to search for it.

Change-Id: Ia7ca312b52336b4731b070d45cf0d768a0d6aeeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/196599
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 21:24:24 +00:00
Emmanuel T Odeke
4faf8a8dc4 net/http, doc/go1.13.html: revert TimeoutHandler.Flush
Also added a test to ensure that any interactions
between TimeoutHandler and Flusher result in the
correct status code and body, but also that we don't
get superfluous logs from stray writes as was seen
in the bug report.

Fixes #34439.

Change-Id: I4af62db256742326f9353f98a2fcb5f71d2a5fd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197659
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26 21:12:34 +00:00
Matthew Dempsky
616c39f6a6 cmd/compile: remove DDD array types
Currently we handle [...]T array literals by treating [...]T as
special "DDD array" types. However, these array literals are just
composite literal syntax, not a distinct Go type. Moreover,
representing them as Go types contributes to complexity in a number of
unrelated bits of code.

This CL changes OCOMPLIT typechecking to look for the [...]T syntax
and handle it specially, so we can remove DDD arrays.

Passes toolstash-check.

Change-Id: Ibbf701eac4caa7a321e2d10e256658fdfaa8a160
Reviewed-on: https://go-review.googlesource.com/c/go/+/197604
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 20:45:09 +00:00
Brad Fitzpatrick
e1b1b7856f cmd/dist: fix bootstrap failure when GOHOSTARCH is set
Fixes #33977

Change-Id: I4b136788f08b08c53087af8d3cd56125e620b51b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197602
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-26 20:45:09 +00:00
Matthew Dempsky
f672e221fc cmd/compile: extract typecheckarraylit function
Typechecking slice literals, array literals, and array literals using
"..." notation all use very similar logic, but tie into the logic for
checking the OCOMPLIT node in slightly different ways.

By refactoring this function out into a separate helper, it makes it
easier to separate slice and array literals, and the subsequent CL
will further separate array literals that do use "..." notation from
those that do not.

Passes toolstash-check.

Change-Id: I4c572e0d9d08bcc86b5c224bd6f9e1c498726c19
Reviewed-on: https://go-review.googlesource.com/c/go/+/197603
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 20:44:28 +00:00
Giovanni Bajo
740d2c8c22 cmd/compile: adjust top-level documentation of poset
Change-Id: I29e24c734e5e0041008771c805a0285aac3e02e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196598
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:47:41 +00:00
Giovanni Bajo
1658263bbf cmd/compile: detect indvars that are bound by other indvars
prove wasn't able to detect induction variables that was bound
by another inducation variable. This happened because an indvar
is a Phi, and thus in case of a dependency, the loop bounding
condition looked as Phi < Phi. This triggered an existing
codepath that checked whether the upper bound was a Phi to
detect loop conditions written in reversed order respect to the
idiomatic way (eg: for i:=0; len(n)>i; i++).

To fix this, we call the indvar pattern matching on both operands
of the loop condition, so that the first operand that matches
will be treated as the indvar.

Updates #24660 (removes a boundcheck from Fannkuch)

Change-Id: Iade83d8deb54f14277ed3f2e37b190e1ed173d11
Reviewed-on: https://go-review.googlesource.com/c/go/+/195220
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:47:12 +00:00
Giovanni Bajo
9740b60e14 cmd/compile: refactor some code in loopbce.go
This CL extracts the logic for pattern-matching an induction
variable into a separate function, in preparation for next CL
where we would need to call it multiple times.

No functional changes, passes toolstash -cmp.

Change-Id: Ic52391e6c1b2e72bae32a0f3f65dfea321caaf4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/195737
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:46:30 +00:00
Matthew Dempsky
fd5ba54f7c cmd/compile: stop exporting OPTRLIT
Removes TODO left by previous commit to appease toolstash.

Change-Id: I5c0bf25f21ba5c0abe3b1b2ed0b17c604717f39b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197121
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 18:46:09 +00:00