1
0
mirror of https://github.com/golang/go synced 2024-11-07 21:06:13 -07:00
Commit Graph

38226 Commits

Author SHA1 Message Date
Clément Chigot
8f9902da26 syscall: add AIX operating system
This commit adds AIX operating system to syscall package for ppc64
architecture.
It also adds the file syscall_aix.go in the runtime package for
syscalls needed during fork and exec.

Updates: #25893

Change-Id: I301b1051b178a3efb7bbc39cdbd8e00b594d65ef
Reviewed-on: https://go-review.googlesource.com/c/138720
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-10 04:29:55 +00:00
Brad Fitzpatrick
c870d56f98 net/http/httputil: fix race/crash in previous ReverseProxy change
The previous ReverseProxy change, CL 137335, introduced a bug which could cause
a race and/or a crash.

This reliably crashed before:

$ go test -short -race -v -run=TestReverseProxyFlushInterval -count=20 net/http/httputil

The problem was a goroutine was running http.ResponseWriter.Flush
after the http.Handler's ServeHTTP completed. There was code to
prevent that (a deferred stop call) but the stop call didn't consider
the case where time.AfterFunc had already fired off a new goroutine
but that goroutine hadn't yet scheduled.

Change-Id: I06357908465a3b953efc33e63c70dec19a501adf
Reviewed-on: https://go-review.googlesource.com/c/140977
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-10-10 02:08:36 +00:00
Wil Selwood
95d06ab6c9 testing: try to Log through parent if test has completed
If the test has already completed when a go routine with a panic
handler reports an error the location of the error call is lost.

Added logDepth to be able to log location of failure at different
depths down the stack.

Fixes #26720

Change-Id: I8b7789ddae757ef6f4bd315cb20356709f4fadec
Reviewed-on: https://go-review.googlesource.com/c/127596
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-10 01:02:14 +00:00
Clément Chigot
49be65eeba syscall: change solaris files to libc files
AIX and Solaris both requires libc to make any syscalls and their
implementation is really similar.
Therefore, Solaris files reused by AIX have their name changed to *_libc.

exec_libc.go is also adapted to AIX.

Updates: #25893

Change-Id: I50d1d7b964831637013d5e64799187cd9565c42b
Reviewed-on: https://go-review.googlesource.com/c/138719
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-10 00:58:17 +00:00
Muhammad Falak R Wani
dc2ae2886f runtime/cgo: annotate unused variable with __attribute__((unused))
Fixes #28095

Change-Id: Id8668d52986c9805213e8847f49fe42dfde2e01a
Reviewed-on: https://go-review.googlesource.com/c/140797
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-10 00:25:54 +00:00
Bryan C. Mills
45e668879d cmd/go: remove extraneous 'file' from usage message in script_test
Previously, erroneous usage would produce error messages like:

	FAIL: testdata/script/mod_tidy_replace.txt:4: usage: stdout [-count=N] 'pattern' file

where the “file” argument is not actually valid for the stdout command.

Change-Id: I74100960f4d25da122faa6c82620995a3fbfc75f
Reviewed-on: https://go-review.googlesource.com/c/140858
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-09 20:10:21 +00:00
Bryan C. Mills
6c85693bf1 cmd/go: check that package paths are invariantly non-empty
The empty string is never a valid package path.
Passing an empty string to a function that expects a package path
indicates some missing validation step further up the call chain —
typically (and most easily) a missed error check.

Change-Id: I78a2403d95b473bacb0d40814cd9d477ecfd5351
Reviewed-on: https://go-review.googlesource.com/c/140857
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-09 20:10:02 +00:00
Matthew Dempsky
48dc42b6af cmd/compile/internal/gc: major evconst cleanup
Major cleanup to structure the code more similarly to go/constant.

Passes "toolstash -cmp" on std cmd.

Change-Id: I3ec7a7a24e313f119b0da4095001aad02e317894
Reviewed-on: https://go-review.googlesource.com/c/139901
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-10-09 19:57:59 +00:00
Muhammad Falak R Wani
d30d5a6b1e go/doc: skip examples with no body
Fixes #28044

Change-Id: I0052e078dd34dc3546204416bcc5a99e3146c535
Reviewed-on: https://go-review.googlesource.com/c/140317
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-10-09 19:41:35 +00:00
Austin Clements
007e8a2fbd runtime: rename gosweepdone to isSweepDone and document better
gosweepdone is another anachronism from the time when the sweeper was
implemented in C. Rename it to "isSweepDone" for the modern era.

Change-Id: I8472aa6f52478459c3f2edc8a4b2761e73c4c2dd
Reviewed-on: https://go-review.googlesource.com/c/138658
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 18:32:08 +00:00
Austin Clements
f3bb4cbfd5 runtime: eliminate gosweepone
gosweepone just switches to the system stack and calls sweepone.
sweepone doesn't need to run on the system stack, so this is pretty
pointless.

Historically, this was necessary because the sweeper was written in C
and hence needed to run on the system stack. gosweepone was the
function that Go code (specifically, bgsweep) used to call into the C
sweeper implementation. This probably became unnecessary in 2014 with
CL golang.org/cl/167540043, which ported the sweeper to Go.

This CL changes all callers of gosweepone to call sweepone and
eliminates gosweepone.

Change-Id: I26b8ef0c7d060b4c0c5dedbb25ecfc936acc7269
Reviewed-on: https://go-review.googlesource.com/c/138657
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 18:20:40 +00:00
Austin Clements
416804f3e2 runtime: simplify free count calculation in (un)cacheSpan
For unclear reasons, cacheSpan and uncacheSpan compute the number of
elements in a span by dividing its size by the element size. This
number is simply available in the mspan structure, so just use it.

Change-Id: If2e5de6ecec39befd3324bf1da4a275ad000932f
Reviewed-on: https://go-review.googlesource.com/c/138656
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 18:20:23 +00:00
Austin Clements
70d7e96c78 runtime: avoid tracking spans with no objects with mcentral
Lazy mcache flushing (golang.org/cl/134783) made it so that moving a
span from an mcache to an mcentral was sometimes responsible for
sweeping the span. However, it did a "preserving" sweep, which meant
it retained ownership, even if the sweeper swept all objects in the
span. As a result, we could put a completely unused span back in the
mcentral.

Fix this by first taking back ownership of the span into the mcentral
and moving it to the right mcentral list, and then doing a
non-preserving sweep. The non-preserving sweep will move the span to
the heap if it sweeps all objects.

Change-Id: I244b1893b44b8c00264f0928ac9239449775f617
Reviewed-on: https://go-review.googlesource.com/c/140597
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-10-09 18:20:13 +00:00
Austin Clements
7d2f46dacd runtime: fix non-in-use span check
Lazy mcache flushing (golang.org/cl/134783) introduced a second value
for sweepgen that indicates a span has been swept. I missed adding
this case to a sanity check in sweepone, so it can now panic if it
finds a non-in-use spans that's been swept *and* put in an mcache.

Fix this by adding the second sweepgen case to this check.

Fixes #27997.

Change-Id: I568d9f2cc8923396ca897a37d154cd2c859c7bef
Reviewed-on: https://go-review.googlesource.com/c/140697
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 18:19:59 +00:00
Austin Clements
1d09433ec0 runtime: undo manual inlining of mbits.setMarked
Since atomic.Or8 is now an intrinsic (and has been for some time),
markBits.setMarked is inlinable. Undo the manual inlining of it.

Change-Id: I8e37ccf0851ad1d3088d9c8ae0f6f0c439d7eb2d
Reviewed-on: https://go-review.googlesource.com/c/138659
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 16:44:45 +00:00
Austin Clements
3f86d7cc67 runtime: tidy mheap.freeSpan
freeSpan currently takes a mysterious "acct int32" argument. This is
really just a boolean and actually just needs to match the "large"
argument to alloc in order to balance out accounting.

To make this clearer, replace acct with a "large bool" argument that
must match the call to mheap.alloc.

Change-Id: Ibc81faefdf9f0583114e1953fcfb362e9c3c76de
Reviewed-on: https://go-review.googlesource.com/c/138655
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 16:43:18 +00:00
Brad Fitzpatrick
5440bfc2ea net/http/httputil: rewrite flushing code, disable on Server-Sent Events
* Rewrite the flushing code to not use a persistent goroutine, which
  also simplifies testing.
* Define the meaning of a negative flush interval. Its meaning doesn't
  change, but now it's locked in, and then we can use it to optimize
  the performance of the non-buffered case to avoid use of an AfterFunc.
* Support (internal-only) special casing of FlushInterval values per
  request/response.
* For now, treat Server-Sent Event responses as unbuffered. (or rather,
  immediately flushed from the buffer per-write)

Fixes #27816

Change-Id: Ie0f975c997daa3db539504137c741a96d7022665
Reviewed-on: https://go-review.googlesource.com/c/137335
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-10-09 15:26:06 +00:00
Qais Patankar
ffc7bc55f3 cmd/compile: fix Compiler Directives typo
Change-Id: I098b3c627c2142affd4e800a2c1f37e00f3775c5
Reviewed-on: https://go-review.googlesource.com/c/140777
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 10:35:08 +00:00
Marten Seemann
465d1c6168 crypto/tls: fix ServerHello SCT test
According to https://tools.ietf.org/html/rfc6962#section-3.3, the SCT
must be at least one byte long. The parsing code correctly checks for
this condition, but rarely the test does generate an empty SCT.

Change-Id: If36a34985b4470a5a9f96affc159195c04f6bfad
Reviewed-on: https://go-review.googlesource.com/c/129755
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-09 04:45:54 +00:00
Ben Shi
ccc337d8ee cmd/compile: combine similar code in amd64's assembly generator
BSFQ/BSRQ/BSFL/BSRL/SQRTSD have similar logic in amd64's assembly
generator. This CL combines them together while does not impact
generated amd64 code. The total size of
pkg/linux_amd64/cmd/compile/internal decreases about 1.8KB.

Change-Id: I5f3210c5178c20ac9108877c69f17234baf5b6b7
Reviewed-on: https://go-review.googlesource.com/c/140438
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-09 03:55:29 +00:00
Ben Shi
3933302550 cmd/compile: add indexed form for several 386 instructions
This CL implements indexed memory operands for the following instructions.
(ADD|SUB|MUL|AND|OR|XOR)Lload -> (ADD|SUB|MUL|AND|OR|XOR)Lloadidx4
(ADD|SUB|AND|OR|XOR)Lmodify -> (ADD|SUB|AND|OR|XOR)Lmodifyidx4
(ADD|AND|OR|XOR)Lconstmodify -> (ADD|AND|OR|XOR)Lconstmodifyidx4

1. The total size of pkg/linux_386/ decreases about 2.5KB, excluding
cmd/compile/ .

2. There is little regression in the go1 benchmark test, excluding noise.
name                     old time/op    new time/op    delta
BinaryTree17-4              3.25s ± 3%     3.25s ± 3%    ~     (p=0.218 n=40+40)
Fannkuch11-4                3.53s ± 1%     3.53s ± 1%    ~     (p=0.303 n=40+40)
FmtFprintfEmpty-4          44.9ns ± 3%    45.6ns ± 3%  +1.48%  (p=0.030 n=40+36)
FmtFprintfString-4         78.7ns ± 5%    80.1ns ± 7%    ~     (p=0.217 n=36+40)
FmtFprintfInt-4            90.2ns ± 6%    89.8ns ± 5%    ~     (p=0.659 n=40+38)
FmtFprintfIntInt-4          140ns ± 5%     141ns ± 5%  +1.00%  (p=0.027 n=40+40)
FmtFprintfPrefixedInt-4     185ns ± 3%     183ns ± 3%    ~     (p=0.104 n=40+40)
FmtFprintfFloat-4           411ns ± 4%     406ns ± 3%  -1.37%  (p=0.005 n=40+40)
FmtManyArgs-4               590ns ± 4%     598ns ± 4%  +1.35%  (p=0.008 n=40+40)
GobDecode-4                7.16ms ± 5%    7.10ms ± 5%    ~     (p=0.335 n=40+40)
GobEncode-4                6.85ms ± 7%    6.74ms ± 9%    ~     (p=0.058 n=38+40)
Gzip-4                      400ms ± 4%     399ms ± 2%  -0.34%  (p=0.003 n=40+33)
Gunzip-4                   41.4ms ± 3%    41.4ms ± 4%  -0.12%  (p=0.020 n=40+40)
HTTPClientServer-4         64.1µs ± 4%    63.5µs ± 2%  -1.07%  (p=0.000 n=39+37)
JSONEncode-4               15.9ms ± 2%    15.9ms ± 3%    ~     (p=0.103 n=40+40)
JSONDecode-4               62.2ms ± 4%    61.6ms ± 3%  -0.98%  (p=0.006 n=39+40)
Mandelbrot200-4            5.18ms ± 3%    5.14ms ± 4%    ~     (p=0.125 n=40+40)
GoParse-4                  3.29ms ± 2%    3.27ms ± 2%  -0.66%  (p=0.006 n=40+40)
RegexpMatchEasy0_32-4       103ns ± 4%     103ns ± 4%    ~     (p=0.632 n=40+40)
RegexpMatchEasy0_1K-4       830ns ± 3%     828ns ± 3%    ~     (p=0.563 n=40+40)
RegexpMatchEasy1_32-4       113ns ± 4%     113ns ± 4%    ~     (p=0.494 n=40+40)
RegexpMatchEasy1_1K-4      1.03µs ± 4%    1.03µs ± 4%    ~     (p=0.665 n=40+40)
RegexpMatchMedium_32-4      130ns ± 4%     129ns ± 3%    ~     (p=0.458 n=40+40)
RegexpMatchMedium_1K-4     39.4µs ± 3%    39.7µs ± 3%    ~     (p=0.825 n=40+40)
RegexpMatchHard_32-4       2.16µs ± 4%    2.15µs ± 4%    ~     (p=0.137 n=40+40)
RegexpMatchHard_1K-4       65.2µs ± 3%    65.4µs ± 4%    ~     (p=0.160 n=40+40)
Revcomp-4                   1.87s ± 2%     1.87s ± 1%  +0.17%  (p=0.019 n=33+33)
Template-4                 69.4ms ± 3%    69.8ms ± 3%  +0.60%  (p=0.009 n=40+40)
TimeParse-4                 437ns ± 4%     438ns ± 4%    ~     (p=0.234 n=40+40)
TimeFormat-4                408ns ± 3%     408ns ± 3%    ~     (p=0.904 n=40+40)
[Geo mean]                 65.7µs         65.6µs       -0.08%

name                     old speed      new speed      delta
GobDecode-4               107MB/s ± 5%   108MB/s ± 5%    ~     (p=0.336 n=40+40)
GobEncode-4               112MB/s ± 6%   114MB/s ± 9%  +1.95%  (p=0.036 n=37+40)
Gzip-4                   48.5MB/s ± 4%  48.6MB/s ± 2%  +0.28%  (p=0.003 n=40+33)
Gunzip-4                  469MB/s ± 4%   469MB/s ± 4%  +0.11%  (p=0.021 n=40+40)
JSONEncode-4              122MB/s ± 2%   122MB/s ± 3%    ~     (p=0.105 n=40+40)
JSONDecode-4             31.2MB/s ± 4%  31.5MB/s ± 4%  +0.99%  (p=0.007 n=39+40)
GoParse-4                17.6MB/s ± 2%  17.7MB/s ± 2%  +0.66%  (p=0.007 n=40+40)
RegexpMatchEasy0_32-4     310MB/s ± 4%   310MB/s ± 4%    ~     (p=0.384 n=40+40)
RegexpMatchEasy0_1K-4    1.23GB/s ± 3%  1.24GB/s ± 3%    ~     (p=0.186 n=40+40)
RegexpMatchEasy1_32-4     283MB/s ± 3%   281MB/s ± 4%    ~     (p=0.855 n=40+40)
RegexpMatchEasy1_1K-4    1.00GB/s ± 4%  1.00GB/s ± 4%    ~     (p=0.665 n=40+40)
RegexpMatchMedium_32-4   7.68MB/s ± 4%  7.73MB/s ± 3%    ~     (p=0.359 n=40+40)
RegexpMatchMedium_1K-4   26.0MB/s ± 3%  25.8MB/s ± 3%    ~     (p=0.825 n=40+40)
RegexpMatchHard_32-4     14.8MB/s ± 3%  14.9MB/s ± 4%    ~     (p=0.136 n=40+40)
RegexpMatchHard_1K-4     15.7MB/s ± 3%  15.7MB/s ± 4%    ~     (p=0.150 n=40+40)
Revcomp-4                 136MB/s ± 1%   136MB/s ± 1%  -0.09%  (p=0.028 n=32+33)
Template-4               28.0MB/s ± 3%  27.8MB/s ± 3%  -0.59%  (p=0.010 n=40+40)
[Geo mean]               82.1MB/s       82.3MB/s       +0.25%

Change-Id: Ifa387a251056678326d3508aa02753b70bf7e5d0
Reviewed-on: https://go-review.googlesource.com/c/140303
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-09 03:55:08 +00:00
Urvil Patel
2afdd17e3f strconv: add example for QuoteRuneToGraphic and QuoteToGraphic functions
Change-Id: Ie5b2ef0087dbc7b8191de8c8b4190396631e3c7f
Reviewed-on: https://go-review.googlesource.com/c/137215
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-08 19:13:38 +00:00
Richard Musiol
e99082fc40 misc/wasm: fix fs operations in browser
The commit 0e4c013 changed the syscall package so it uses the
asynchronous functions of Node.js's fs module.

This commit adapts the stubs of the fs module which are used when using
a browser instead of Node.js.

Fixes #28068.

Change-Id: Ic3a6a8aebb0db06402383bc2fea7642a4501e02c
Reviewed-on: https://go-review.googlesource.com/c/140537
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-08 18:33:23 +00:00
Robert Griesemer
26d22609c3 spec: distinguish between explicit and implicit conversions (clarification)
The spec used the term "conversion" somewhat indiscriminately for
explicit conversions that appear literally in the source, and implicit
conversions that are implied by the context of an expression.
Be clearer about it by defining the terms.

Also, state that integer to string conversions of the form string(x)
are never implicit. This clarifies situations where implicit conversions
might require an integer to change to a string (but don't and never have
done so). See line 3948.

Fixes #26313.

Change-Id: I8939466df6b5950933ae7c987662ef9f88827fda
Reviewed-on: https://go-review.googlesource.com/c/139099
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-08 17:47:49 +00:00
Alex Brainman
7c3b324d26 net: skip TestUnixConnLocalWindows on windows/arm
Similarly to CL 138676, skip TestUnixConnLocalWindows on windows/arm.

Fixes #28061

Change-Id: I2270d2f9d268e85ea567be0c0c37c48e4d482282
Reviewed-on: https://go-review.googlesource.com/c/140397
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-08 04:13:54 +00:00
Igor Zhilianin
04dc1b2443 all: fix a bunch of misspellings
Change-Id: I94cebca86706e072fbe3be782d3edbe0e22b9432
GitHub-Last-Rev: 8e15a40545
GitHub-Pull-Request: golang/go#28067
Reviewed-on: https://go-review.googlesource.com/c/140437
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-08 03:12:03 +00:00
ludweeg
165ebaf97b net: simplify bool expression
Simplify `!(x <= y)` to `x > y` and `!(x >= y)` to `x < y` where x,y are not defined as float.

Change-Id: Id1e5b518395d97e75f96aa4ac5d6c0ee990c0e7d
Reviewed-on: https://go-review.googlesource.com/c/140337
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2018-10-07 02:36:02 +00:00
Lehner Florian
2bb91e093c fmt: add example Sscanf
Updates golang/go#27554.

Change-Id: I2bf3d57ebeeb5dd50beffbc643a4ad10287b2c1e
GitHub-Last-Rev: 4ffae55b4b
GitHub-Pull-Request: golang/go#27954
Reviewed-on: https://go-review.googlesource.com/c/138837
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-06 19:18:34 +00:00
Yasuhiro Matsumoto
46cf91a75f all: fix typos
Change-Id: I775eb4b33422a95f4255799d551c9962d7e181d3
Reviewed-on: https://go-review.googlesource.com/c/140318
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-10-06 17:09:47 +00:00
Keith Randall
6933d76a7e cmd/compile: allow VARDEF at top level
This was missed as part of adding a top-level VARDEF
for stack tracing (CL 134156).

Fixes #28055

Change-Id: Id14748dfccb119197d788867d2ec6a3b3c9835cf
Reviewed-on: https://go-review.googlesource.com/c/140304
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2018-10-06 16:28:04 +00:00
Igor Zhilianin
f90e89e675 all: fix a bunch of misspellings
Change-Id: If2954bdfc551515403706b2cd0dde94e45936e08
GitHub-Last-Rev: d4cfc41a55
GitHub-Pull-Request: golang/go#28049
Reviewed-on: https://go-review.googlesource.com/c/140299
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-06 15:40:03 +00:00
Gabriel Aszalos
9f193fbe31 encoding/json: use isSpace in stateEndTop
This change makes stateEndTop use isSpace instead of specifically
recreating the same functionality.

Change-Id: I81f8f51682e46e7f8e2b9fed423a968457200625
Reviewed-on: https://go-review.googlesource.com/c/121797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-06 15:40:02 +00:00
Tim Cooper
8aee193fb8 all: remove unneeded parentheses from package consts and vars
Change-Id: Ic7fce53c6264107c15b127d9c9ca0bec11a888ff
Reviewed-on: https://go-review.googlesource.com/c/138183
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-06 12:11:53 +00:00
Roberto
963776e689 sync: fix typo in doc
Change-Id: Ie1f35c7598bd2549a048d64e1b1279bf4acaa103
GitHub-Last-Rev: c8cc7dfef9
GitHub-Pull-Request: golang/go#28051
Reviewed-on: https://go-review.googlesource.com/c/140302
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2018-10-06 12:04:57 +00:00
Ben Shi
2294e3ebd3 cmd/compile: combine similar code in amd64's assembly generator
This CL combines similar code in amd64's assembly generator. The
total size of pkg/linux_amd64/cmd/compile/ decreases about 4.5KB,
while the generated amd64 code is not affected.

Change-Id: I4cdbdd22bde8857aafdc29b47fa100a906fa1598
Reviewed-on: https://go-review.googlesource.com/c/140298
Run-TryBot: Ben Shi <powerman1st@163.com>
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-06 08:50:33 +00:00
Ben Shi
dc492682b6 cmd/compile: combine 386 rules via regular expression
This CL combines similar rules together via regular expression,
while does not impact generated 386 code.

Change-Id: I2b26e7fc6adffa0fa10eeb04a4f3a76ddabc760b
Reviewed-on: https://go-review.googlesource.com/c/140297
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-06 03:54:54 +00:00
Ben Shi
30c1ed7d0b cmd/compile: simplify 386's rules
This CL combines several rules together via regular expression,
but won't impact generated 386 code.

Change-Id: I354006fe801fc952e3a9431cae63229922c9ba48
Reviewed-on: https://go-review.googlesource.com/c/139957
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-06 00:02:35 +00:00
Ben Shi
7b8b3f30ed cmd/compile: combine similar code in 386's assembly generator
The indexed MOVload and MOVstore have similar logic, and this CL
combine them together. The total size of pkg/linux_386/cmd/compile/
decreases about 4KB.

Change-Id: I06236a3542aaa3dfc113c49fe4c69d209e018dfe
Reviewed-on: https://go-review.googlesource.com/c/139958
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-06 00:02:16 +00:00
Alberto Donizetti
430b9cb92f runtime: revert "skip TestLldbPython when lldb is too old"
This reverts commit d217004061.

Reason for revert: It broke all the darwin builders; it's also not
obvious how the weird darwin versions (900, 1000) relate to the > 3.9
requisite, so I'm not sure how to decide about skipping in a robust
way. It's better to revert the check for now.

Fixes #28028

Change-Id: Ibbcb7bf7cd2136e0851ebd097a2bc4dec9f0ee18
Reviewed-on: https://go-review.googlesource.com/c/140217
Reviewed-by: Keith Randall <khr@golang.org>
2018-10-05 22:24:04 +00:00
Mikio Hara
9d907160d4 vendor: update golang_org/x/net/route from upstream
Updates the route package to git rev 146acd2 for:
- 146acd2 don't run NET_RT_IFLIST vs. NET_RT_IFLISTL test in 386 emulation (again)

Change-Id: I24de1eb31b2ca0e24cb9ab1648f7a71b5067cf97
Reviewed-on: https://go-review.googlesource.com/c/139937
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-05 21:53:34 +00:00
Yuval Pavel Zholkover
dc6eb200dd syscall: FreeBSD 12 ino64 support
This is similar to CL 136816 for x/sys/unix, changing the FreeBSD ABI to use 64-bit inodes in
Stat_t, Statfs_t, and Dirent types.

The changes are forward compatible, that is FreeBSD 10.x, 11.x continue to use their current sysnum numbers.
The affected types are converted to the new layout (with some overhead).
Thus the same statically linked binary should work using the native sysnums (without any conversion) on FreeBSD 12.

Breaking API changes in package syscall are:
Mknod takes a uint64 (C dev_t) instead of int.
Stat_t: Dev, Ino, Nlink, Rdev, Gen became uint64.
  Atimespec, Mtimespec, Ctimespec, Birthtimespec renamed to Atim, Mtim, Ctim, Birthtim respectively.

Statfs_t: Mntonname and Mntfromname changed from [88]int8 to [1024]int8 arrays.

Dirent: Fileno became uint64, Namlen uint16 and an additional field Off int64 (currently unused) was added.

The following commands were run to generate ztypes_* and zsyscall_* on FreeBSD-12.0-ALPHA6 systems (GOARCH=386 were run on the same amd64 host):
GOOS=freebsd GOARCH=amd64 ./mksyscall.pl -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go |gofmt >zsyscall_freebsd_amd64.go
GOOS=freebsd GOARCH=amd64 go tool cgo -godefs types_freebsd.go | GOOS=freebsd GOARCH=amd64 go run mkpost.go >ztypes_freebsd_amd64.go

GOOS=freebsd GOARCH=386 ./mksyscall.pl -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go |gofmt >zsyscall_freebsd_386.go
GOOS=freebsd GOARCH=386 go tool cgo -godefs types_freebsd.go | GOOS=freebsd GOARCH=386 go run mkpost.go >ztypes_freebsd_386.go

GOOS=freebsd GOARCH=arm ./mksyscall.pl -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go |gofmt >zsyscall_freebsd_arm.go
GOOS=freebsd GOARCH=arm go tool cgo -godefs -- -fsigned-char types_freebsd.go | GOOS=freebsd GOARCH=arm go run mkpost.go >ztypes_freebsd_arm.go

The Kevent struct was changed to use the FREEBSD_COMPAT11 version always (requiring the COMPAT_FREEBSD11 kernel option FreeBSD-12, this is the default).

The definitions of ifData were not updated, their functionality in has have been replaced by vendored golang.org/x/net/route.

freebsdVersion initialization was dropped from init() in favor of a sync.Once based wrapper - supportsABI().

Updates #22448.

Change-Id: I359b756e2849c036d7ed7f75dbd6ec836e0b90b4
Reviewed-on: https://go-review.googlesource.com/c/138595
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-05 21:38:13 +00:00
Jordan Rhee
3d19d95932 debug/pe: fix TestDWARF to work with relocations
Fixes #27904

Change-Id: Ie2aad20cd66785b6cc1018c0048824382cb39f8c
Reviewed-on: https://go-review.googlesource.com/c/140158
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-05 20:30:11 +00:00
Tobias Klauser
68d52969dd runtime: remove unused armArch
runtime.armArch is unused on linux/arm since CL 93637. The new code in
runtime/internal/atomic (added by CL 111315) only checks runtime.goarm.

Change-Id: Ic097ee6750e39abb20f45770a1c7c2d925f02408
Reviewed-on: https://go-review.googlesource.com/c/140077
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-05 19:52:26 +00:00
Robert Griesemer
497fd2c09c go/types: remove a TODO, enable a test
1) Scopes do have a comment field for documentation (debugging output).
   No need to do anything extra.

2) The testcase in expr3.src has ok error messages. Enabled.

Change-Id: Ic1a03bfec0a6a70d876aa6cfb936973abe58fe6c
Reviewed-on: https://go-review.googlesource.com/c/139902
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-05 17:56:34 +00:00
Robert Griesemer
71d40c492f go/types: remove work-around for issue #26390
This work-around is not needed anymore now that method
signatures are type-checked separately from their receiver
base types: no artificial cycles are introduced anymore
and so there is no need to artificially cut them.

Fixes #26854.

Change-Id: I2ef15ceeaa0b486f65f6cdc466d0cf06246c74d7
Reviewed-on: https://go-review.googlesource.com/c/139900
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-05 17:56:28 +00:00
Robert Griesemer
6d51dd1e85 go/types: remove work-around for issue #26124
This work-around is not needed anymore now that method
signatures are type-checked separately from their receiver
base types: no artificial cycles are introduced anymore
and so there is no need to artificially cut them.

Updates #26124.

Change-Id: I9d50171f12dd8977116a5d3f63ac39a06b1cd492
Reviewed-on: https://go-review.googlesource.com/c/139899
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-05 17:56:22 +00:00
Robert Griesemer
8ae8576abf go/types: don't type-check method signatures eagerly anymore
As a side-effect we also get slightly clearer errors for some
pathological cyclic method declarations.

Fixes #23203.
Updates #26854.

Change-Id: I30bd6634ac6be26d3f4ef8c7b32e5c1bf76987dd
Reviewed-on: https://go-review.googlesource.com/c/139897
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-05 17:56:17 +00:00
Robert Griesemer
bf9240681d go/types: prepare for delayed type-checking of methods to when they are used
Remove assumption that methods associated to concrete (non-interface)
types have a fully set up signature. Such methods are found through
LookupFieldOrMethod or lookupMethod, or indexed method access from
a Named type. Make sure that the method's signature is type-checked
before use in those cases.

(MethodSets also hold methods but the type checker is not using
them but for internal verification. API clients will be using it
after all methods have been type-checked.)

Some functions such as MissingMethod may now have to type-check a
method and for that they need a *Checker. Add helper functions as
necessary to provide the additional (receiver) parameter but permit
it to be nil if the respective functions are invoked through the API
(at which point we know that all methods have a proper signature and
thus we don't need the delayed type-check).

Since all package-level objects eventually are type-checked through
the top-level loop in Checker.packageObjects we are guaranteed that
all methods will be type-checked as well.

Updates #23203.
Updates #26854.

Change-Id: I6e48f0016cefd498aa70b776e84a48215a9042c5
Reviewed-on: https://go-review.googlesource.com/c/139425
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-05 17:56:11 +00:00
Robert Griesemer
f2c1c7acf8 go/types: fix recvPtr helper (follow-up on https://golang.org/cl/139422)
The prior CL prepared go/types for the situation where methods might
not have a type-checked signature when being looked up. The respective
adjustments to recvPtr were not correct (but because so far method
signatures are type-checked in time, the bug didn't manifest itself).

Updates #23203.
Updates #26854.

Change-Id: I796691d11e6aac84396bdef802ad30715755fcc6
Reviewed-on: https://go-review.googlesource.com/c/139721
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-05 17:56:05 +00:00
Meng Zhuo
28fa1da9db cmd/api: explicit tagKey with GOOS and GOARCH
The origin tagKey is just dirname if no tags input which will cause
pkgCache missmatch if other imported pkg explicit on GOARCH or GOOS

This CL will add GOOS and GOARCH to tagKey

Fixes #8425
Fixes #21181

Change-Id: Ifc189cf6746d753ad7c7e5bb60621297fc0a4e35
Reviewed-on: https://go-review.googlesource.com/c/138315
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-10-05 17:53:43 +00:00