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

39210 Commits

Author SHA1 Message Date
Michael Anthony Knyszek
9ed9df6ca2 runtime: avoid write barrier in startpanic_m
startpanic_m could be called correctly in a context where there's a
valid G, a valid M, but no P, for example in a signal handler which
panics. Currently, startpanic_m has write barriers enabled because
write barriers are permitted if a G's M is dying. However, all the
current write barrier implementations assume the current G has a P.

Therefore, in this change we disable write barriers in startpanic_m,
remove the only pointer write which clears g.writebuf, and fix up gwrite
to ignore the writebuf if the current G's M is dying, rather than
relying on it being nil in the dying case.

Fixes #26575.

Change-Id: I9b29e6b9edf00d8e99ffc71770c287142ebae086
Reviewed-on: https://go-review.googlesource.com/c/154837
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2018-12-19 00:13:22 +00:00
Jordan Rhee
e3b4b7baad runtime: use QPC for nanotime and time.now on windows/arm
The previous implementation of nanotime and time.now used a time source
that was updated on the system clock tick, which has a maximum
resolution of about 1ms. On 386 and amd64, this time source maps to
the system performance counter, so has much higher resolution.
On ARM, use QueryPerformanceCounter() to get a high resolution timestamp.

Updates #26148

Change-Id: I1abc99baf927a95b472ac05020a7788626c71d08
Reviewed-on: https://go-review.googlesource.com/c/154758
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-18 23:01:06 +00:00
Elias Naur
9ded8b0e97 doc/go1.12: note that syscall.Getdirentries is no longer supported on iOS
Change-Id: I4277f4130b460b42c5b51fd5a5e07f6c0e62163b
Reviewed-on: https://go-review.googlesource.com/c/154720
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-18 22:40:56 +00:00
Filippo Valsorda
9d0318fc9d api: promote next to go1.12
Change-Id: I9a30c76d1299a494cce69b1060156bc2932ac8d5
Reviewed-on: https://go-review.googlesource.com/c/154857
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-18 21:27:51 +00:00
Kevin Burke
c343b6b2b8 os: show how to print permission bits in octal
Permission bits are most commonly viewed in string form (rwx-- etc) or
in octal form (0755), but the latter is relatively rare in Go.
Demonstrate how to print a FileMode in readable octal format.

Change-Id: I41feb801bcecb5077d4eabafdea27c149fc179a1
Reviewed-on: https://go-review.googlesource.com/c/154423
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 21:17:16 +00:00
Michael Anthony Knyszek
7ef718f16f runtime: call mmap with MAP_FIXED on BSDs in race mode
This change makes it so that reserving more of the address space for the
heap calls mmap with MAP_FIXED in race mode. Race mode requires certain
guarantees on where the heap is located in the address space, and on
Darwin 10.10 it appears that the kernel may end up ignoring the hint
quite often (#26475). Using MAP_FIXED is relatively OK in race mode
because nothing else should be mapped in the memory region provided by
the initial hints.

Fixes #26475.

Change-Id: Id7ac1534ee74f6de491bc04441f27dbda09f0285
Reviewed-on: https://go-review.googlesource.com/c/153897
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-18 21:05:05 +00:00
Ian Lance Taylor
d689946302 cmd/cover: avoid repeating positions
When using //line directives and unformatted code it is possible for
positions to repeat. Increment the final column position to avoid that.

Fixes #27350

Change-Id: I2faccc31360075e9814d4a024b0f98b117f8ce97
Reviewed-on: https://go-review.googlesource.com/c/153061
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-12-18 20:57:18 +00:00
Ian Lance Taylor
77caea5bf2 cmd/cover: use -toolexec in tests to run newly built cover program
This ensures that "go test cmd/cover" tests the current cover program,
not the installed cover program.

Change-Id: I58e718ded7eb1cd8da448d0194262209bb025b20
Reviewed-on: https://go-review.googlesource.com/c/153058
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 20:55:57 +00:00
Cherry Zhang
d063b7c6d3 cmd/dist: enable race detector test on Linux/ARM64
CL 138675 added the race detector support on Linux/ARM64, but it
didn't enable the race detector tests in cmd/dist (therefore in
all.bash). Enable them.

Updates #28848

Change-Id: I4306dad2fb4167021d568436076b9f535d7f6e07
Reviewed-on: https://go-review.googlesource.com/c/149967
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-18 20:50:43 +00:00
Filippo Valsorda
4e9b3ba84d doc/go1.12: finish most Go 1.12 release notes
Change-Id: I598c9a2031001a6780b75c31d9015c880741b170
Reviewed-on: https://go-review.googlesource.com/c/154637
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 20:13:07 +00:00
Dmitri Shuralyov
c040786f37 doc/go1.12: add notes for syscall/js CLs 141644, 143137, 144384
Also update a Go 1 compatibility promise link to canonical URL.

Updates #27592
Updates #28264

Change-Id: I5994a0a63e0870c1795c65016590dfad829d26a7
Reviewed-on: https://go-review.googlesource.com/c/154618
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 16:45:33 +00:00
Martin Möhrmann
5777e9700f doc/go1.12: add release notes for GODEBUG internal/cpu options
Change-Id: Id68b62138e14d13bb352b14c7f42bcef5601eee3
Reviewed-on: https://go-review.googlesource.com/c/154717
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 16:18:54 +00:00
Clément Chigot
3855fe7254 runtime: fix backtrace during C syscalls for aix/ppc64
This commit fixes backtrace if a crash or an exit signal is received
during a C syscall on aix/ppc64.
This is similar to Solaris, Darwin or Windows implementation.

Change-Id: I6040c0b1577a9f5b298f58bd4ee6556258a135ef
Reviewed-on: https://go-review.googlesource.com/c/154718
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-18 15:43:50 +00:00
Clément Chigot
cebf9d47cf cmd/link: optimize access to data symbols for aix/ppc64
This commit changes the second instruction used to retrieve a symbol on
aix/ppc64 if it is in .data or .bss section.

The previous version always retrieves the symbol address via a load on
its TOC symbol. However, as the TOC is also in .data, the symbol's address
is close enough to be fetched directly and the load instruction can be
replaced by an addi.

Bench go1
benchmark                             old ns/op      new ns/op      delta
BenchmarkBinaryTree17-16              5919354000     5824897000     -1.60%
BenchmarkFannkuch11-16                5206937000     5162043000     -0.86%
BenchmarkFmtFprintfEmpty-16           106            105            -0.94%
BenchmarkFmtFprintfString-16          165            165            +0.00%
BenchmarkFmtFprintfInt-16             165            167            +1.21%
BenchmarkFmtFprintfIntInt-16          303            239            -21.12%
BenchmarkFmtFprintfPrefixedInt-16     282            283            +0.35%
BenchmarkFmtFprintfFloat-16           434            381            -12.21%
BenchmarkFmtManyArgs-16               1797           903            -49.75%
BenchmarkGobDecode-16                 16000450       12173630       -23.92%
BenchmarkGobEncode-16                 12007010       10258070       -14.57%
BenchmarkGzip-16                      638581500      456050333      -28.58%
BenchmarkGunzip-16                    111976900      74943900       -33.07%
BenchmarkHTTPClientServer-16          206850         153716         -25.69%
BenchmarkJSONEncode-16                32057380       17517130       -45.36%
BenchmarkJSONDecode-16                182606400      106807700      -41.51%
BenchmarkMandelbrot200-16             6896975        5616903        -18.56%
BenchmarkGoParse-16                   11248260       6094115        -45.82%
BenchmarkRegexpMatchEasy0_32-16       292            148            -49.32%
BenchmarkRegexpMatchEasy0_1K-16       540            327            -39.44%
BenchmarkRegexpMatchEasy1_32-16       243            150            -38.27%
BenchmarkRegexpMatchEasy1_1K-16       1029           657            -36.15%
BenchmarkRegexpMatchMedium_32-16      423            230            -45.63%
BenchmarkRegexpMatchMedium_1K-16      107250         59683          -44.35%
BenchmarkRegexpMatchHard_32-16        3353           3139           -6.38%
BenchmarkRegexpMatchHard_1K-16        107277         93610          -12.74%
BenchmarkRevcomp-16                   1124311500     677442500      -39.75%
BenchmarkTemplate-16                  241286600      109177400      -54.75%
BenchmarkTimeParse-16                 1058           562            -46.88%
BenchmarkTimeFormat-16                1321           581            -56.02%

benchmark                            old MB/s     new MB/s     speedup
BenchmarkGobDecode-16                47.97        63.05        1.31x
BenchmarkGobEncode-16                63.92        74.82        1.17x
BenchmarkGzip-16                     30.39        42.55        1.40x
BenchmarkGunzip-16                   173.29       258.92       1.49x
BenchmarkJSONEncode-16               60.53        110.78       1.83x
BenchmarkJSONDecode-16               10.63        18.17        1.71x
BenchmarkGoParse-16                  5.15         9.50         1.84x
BenchmarkRegexpMatchEasy0_32-16      109.42       215.86       1.97x
BenchmarkRegexpMatchEasy0_1K-16      1896.22      3126.28      1.65x
BenchmarkRegexpMatchEasy1_32-16      131.46       212.99       1.62x
BenchmarkRegexpMatchEasy1_1K-16      994.55       1557.51      1.57x
BenchmarkRegexpMatchMedium_32-16     2.36         4.34         1.84x
BenchmarkRegexpMatchMedium_1K-16     9.55         17.16        1.80x
BenchmarkRegexpMatchHard_32-16       9.54         10.19        1.07x
BenchmarkRegexpMatchHard_1K-16       9.55         10.94        1.15x
BenchmarkRevcomp-16                  226.06       375.19       1.66x
BenchmarkTemplate-16                 8.04         17.77        2.21x

Change-Id: Iaf2aa5953b99271361510c69a5ced3371f6c6c20
Reviewed-on: https://go-review.googlesource.com/c/151201
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-18 15:42:01 +00:00
Clément Chigot
34437f04fd doc/1.12: add notes about aix/ppc64 port
Fixes #29315

Change-Id: I6ecc5109c23e7a7d9db54250bf041acc841701e3
Reviewed-on: https://go-review.googlesource.com/c/154697
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 15:25:24 +00:00
Austin Clements
2d00007bdb runtime: flush on every write barrier while debugging
Currently, we flush the write barrier buffer on every write barrier
once throwOnGCWork is set, but not during the mark completion
algorithm itself. As seen in recent failures like

  https://build.golang.org/log/317369853b803b4ee762b27653f367e1aa445ac1

by the time we actually catch a late gcWork put, the write barrier
buffer is full-size again.

As a result, we're probably not catching the actual problematic write
barrier, which is probably somewhere in the buffer.

Fix this by using the gcWork pause generation to also keep the write
barrier buffer small between the mark completion flushes it and when
mark completion is done.

For #27993.

Change-Id: I77618169441d42a7d562fb2a998cfaa89891edb2
Reviewed-on: https://go-review.googlesource.com/c/154638
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-12-18 15:17:50 +00:00
Martin Möhrmann
9a258f3086 doc: document GODEBUG options to disable use of instruction set extensions
Fixes #27218

Change-Id: I4eb8e8f2486b20fe0ed6e3e2c6ec521c9e8c0032
Reviewed-on: https://go-review.googlesource.com/c/149579
Reviewed-by: Austin Clements <austin@google.com>
2018-12-18 14:59:36 +00:00
Joel Sing
c52beb1087 runtime,cmd/dist,cmd/link: add cgo support on openbsd/arm
Add support for cgo on openbsd/arm.The gcc shipped with base OpenBSD armv7
is old/inadequate, so use clang by default.

Change-Id: I945a26d369378952d357727718e69249411e1127
Reviewed-on: https://go-review.googlesource.com/c/154381
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-18 12:02:45 +00:00
Robert Griesemer
99e4ddd053 cmd/compile: increase nesting depth limit for type descriptors
The formatting routines for types use a depth limit as primitive
mechanism to detect cycles. For now, increase the limit from 100
to 250 and file #29312 so we don't drop this on the floor.

Also, adjust some fatal error messages elsewhere to use
better formatting.

Fixes #29264.
Updates #29312.

Change-Id: Idd529f6682d478e0dcd2d469cb802192190602f6
Reviewed-on: https://go-review.googlesource.com/c/154583
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 00:13:58 +00:00
Ian Lance Taylor
32b879c674 doc: explain how to use "go vet -shadow"
Fixes #29260

Change-Id: I419b74d06380113f4bd32b9aeb053c3be36208d5
Reviewed-on: https://go-review.googlesource.com/c/154584
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-12-17 23:49:15 +00:00
Michael Anthony Knyszek
064842450b runtime: allocate from free and scav fairly
This change modifies the behavior of span allocations to no longer
prefer the free treap over the scavenged treap.

While there is an additional cost to allocating out of the scavenged
treap, the current behavior of preferring the unscavenged spans can
lead to unbounded growth of a program's virtual memory footprint.

In small programs (low # of Ps, low resident set size, low allocation
rate) this behavior isn't really apparent and is difficult to
reproduce.

However, in relatively large, long-running programs we see this
unbounded growth in free spans, and an unbounded amount of heap
growths.

It still remains unclear how this policy change actually ends up
increasing the number of heap growths over time, but switching the
policy back to best-fit does indeed solve the problem.

Change-Id: Ibb88d24f9ef6766baaa7f12b411974cc03341e7b
Reviewed-on: https://go-review.googlesource.com/c/148979
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2018-12-17 23:28:36 +00:00
Michael Anthony Knyszek
3651476075 runtime: add iterator abstraction for mTreap
This change adds the treapIter type which provides an iterator
abstraction for walking over an mTreap. In particular, the mTreap type
now has iter() and rev() for iterating both forwards (smallest to
largest) and backwards (largest to smallest). It also has an erase()
method for erasing elements at the iterator's current position.

For #28479.

While the expectation is that this change will slow down Go programs,
the impact on Go1 and Garbage is negligible.

Go1:     https://perf.golang.org/search?q=upload:20181214.6
Garbage: https://perf.golang.org/search?q=upload:20181214.11

Change-Id: I60dbebbbe73cbbe7b78d45d2093cec12cc0bc649
Reviewed-on: https://go-review.googlesource.com/c/151537
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-12-17 23:28:18 +00:00
Clément Chigot
9a3c1a1bc8 cmd/link: move XCOFF data addresses to an unreachable segment
This commit move data addresses to 0x200000000 for XCOFF executables.
.data and .bss must always be position-independent on AIX. This
modification allows to detect more easily if they aren't, as segfault
will be triggered.

Change-Id: Ied7a5b72b9f4ff9f870a1626cf07c48110635e62
Reviewed-on: https://go-review.googlesource.com/c/151040
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-17 23:03:47 +00:00
David Chase
d924c3336c cmd/compile: prevent double-walk of switch for OPRINT/OPRINTN
When a println arg contains a call to an inlineable function
that itself contains a switch, that switch statement will be
walked twice, once by the walkexprlist formerly in the
OPRINT/OPRINTN case, then by walkexprlistcheap in walkprint.

Remove the first walkexprlist, it is not necessary.
walkexprlist =
		s[i] = walkexpr(s[i], init)
walkexprlistcheap = {
		s[i] = cheapexpr(n, init)
		s[i] = walkexpr(s[i], init)
}

Seems like this might be possible in other places, i.e.,
calls to inlineable switch-containing functions.

See also #25776.
Fixes #29220.

Change-Id: I3781e86aad6688711597b8bee9bc7ebd3af93601
Reviewed-on: https://go-review.googlesource.com/c/154497
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-12-17 22:49:21 +00:00
Michael Anthony Knyszek
213845f7b9 runtime: fix sysUsed for Windows
sysUsed on Windows cares about the result from the VirtualAlloc syscall
returning exactly the address that was passed to it. However,
VirtualAlloc aligns the address its given to the kernel's allocation
granularity, so the returned address may not be the same.

Note that this wasn't an issue in the past because we only sysUsed
regions owned by spans, and spans are always a multiple of 8K, which
is a multiple of the allocation granularity on most Windows machines.

Change-Id: I3f5ccd63c6bbbd8b7995945ecedee17573b31667
Reviewed-on: https://go-review.googlesource.com/c/153677
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-12-17 22:42:27 +00:00
Filippo Valsorda
81a908aa68 doc/go1.12: release notes for crypto
Change-Id: I2a5613377a38815fb8746c5bfb07ccbbc2e6dd0b
Reviewed-on: https://go-review.googlesource.com/c/153829
Reviewed-by: Adam Langley <agl@golang.org>
2018-12-17 22:40:47 +00:00
Filippo Valsorda
6e33abbdbb doc/go1.12: release notes for "go doc -all"
Change-Id: If65518c76a865c03266be76b1c21c76e1c8b4763
Reviewed-on: https://go-review.googlesource.com/c/153828
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-17 22:32:08 +00:00
Austin Clements
ccbca561ef runtime: capture pause stack for late gcWork put debugging
This captures the stack trace where mark completion observed that each
P had no work, and then dumps this if that P later discovers more
work. Hopefully this will help bound where the work was created.

For #27993.

Change-Id: I4f29202880d22c433482dc1463fb50ab693b6de6
Reviewed-on: https://go-review.googlesource.com/c/154599
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-12-17 21:24:19 +00:00
Austin Clements
db1e8a9e1f runtime: make traceback indicate whether _defer was just allocated
Many of the crashes observed in #27993 involve committing the new
_defer object at the end of newdefer. It would be helpful to know if
the _defer was just allocated or was retrieved from the defer pool. In
order to indicate this in the traceback, this CL duplicates the tail
of newdefer so that the PC/line number will tell us whether d is new
or not.

For #27993.

Change-Id: Icd3e23dbcf00461877bb082b6f18df701149a607
Reviewed-on: https://go-review.googlesource.com/c/154598
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-12-17 21:24:13 +00:00
Austin Clements
3c255e8bc6 runtime: record extra information in throwOnGCWork crashes
Currently we only know the slot address and the value being written in
the throwOnGCWork crash tracebacks, and we have to infer the old value
from what's dumped by gcWork.checkPut. Sometimes these old values
don't make sense, like when we see a write of a nil pointer to a
freshly-allocated object, yet we observe marking a value (where did
that pointer come from?).

This CL adds the old value of the slot and the first two pointers in
the buffer to the traceback.

For #27993.

Change-Id: Ib70eead1afb9c06e8099e520172c3a2acaa45f80
Reviewed-on: https://go-review.googlesource.com/c/154597
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-12-17 21:24:06 +00:00
Clément Chigot
503091a77c cmd: improve aix/ppc64 new symbol addressing
This commit updates the new symbol addressing made for aix/ppc64 according
to feedbacks given in CL 151039.

Change-Id: Ic4eb9943dc520d65f7d084adf8fa9a2530f4d3f9
Reviewed-on: https://go-review.googlesource.com/c/151302
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-17 21:13:09 +00:00
Austin Clements
179acf4083 doc/go1.12: updates for runtime and compiler
Change-Id: Ifb16fd28105efd05cebbd615b52e45330b77cede
Reviewed-on: https://go-review.googlesource.com/c/154600
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-17 21:12:59 +00:00
Robert Griesemer
a1aafd8b28 cmd/compile: generate interface method expression wrapper for error.Error
A prior optimization (https://golang.org/cl/106175) removed the
generation of unnecessary method expression wrappers, but also
eliminated the generation of the wrapper for error.Error which
was still required.

Special-case error type in the optimization.

Fixes #29304.

Change-Id: I54c8afc88a2c6d1906afa2d09c68a0a3f3e2f1e3
Reviewed-on: https://go-review.googlesource.com/c/154578
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-17 19:48:36 +00:00
Austin Clements
fe2feb978e runtime: poison the write barrier buffer during flushing
Currently we reset the write barrier buffer before processing the
pointers in it. As a result, if there were any write barriers in the
code that processes the buffer, it would corrupt the write barrier
buffer and cause us to mark objects without later scanning them.

As far as I can tell, this shouldn't be happening, but rather than
relying on hope (and incomplete static analysis), this CL changes
wbBufFlush1 to poison the write barrier buffer while processing it,
and only reset it once it's done.

Updates #27993. (Unlike many of the other changes for this issue,
there's no need to roll back this CL. It's a good change in its own
right.)

Change-Id: I6d2d9f1b69b89438438b9ee624f3fff9f009e29d
Reviewed-on: https://go-review.googlesource.com/c/154537
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-12-17 19:35:11 +00:00
Clément Chigot
bed88f4e81 cmd/link: fix error messages for external linking on ppc64
This commit fixes error messages displayed on aix/ppc64 with external
linking.

Change-Id: I5311d36f30394be717827891e070db249482814a
Reviewed-on: https://go-review.googlesource.com/c/151041
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-17 16:40:55 +00:00
Alex Brainman
e4535772ca os: make Stat work on FAT file system
It appears calling GetFileInformationByHandleEx with
FILE_ATTRIBUTE_TAG_INFO fails on FAT file system. FAT does not
support symlinks, so assume there are no symlnks when
GetFileInformationByHandleEx returns ERROR_INVALID_PARAMETER.

Fixes #29214

Change-Id: If2d9f3288bd99637681ab5fd4e4581c77b578a69
Reviewed-on: https://go-review.googlesource.com/c/154377
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-17 09:34:04 +00:00
Joel Sing
bc175e53cc cmd/dist: re-enable VFPv3 on openbsd/arm
The OpenBSD armv7 port has working VFPv3 these days - re-enable the VFP
detection code so that GOARM=7 is used by default on openbsd/arm.

Change-Id: I0271d81c048d2d55becd2803c19e5f1542076357
Reviewed-on: https://go-review.googlesource.com/c/154378
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-12-17 03:49:37 +00:00
Austin Clements
a27f3d5cfb runtime: fix hangs in TestDebugCall*
This fixes a few different issues that led to hangs and general
flakiness in the TestDebugCall* tests.

1. This fixes missing wake-ups in two error paths of the SIGTRAP
   signal handler. If the goroutine was in an unknown state, or if
   there was an unknown debug call status, we currently don't wake the
   injection coordinator. These are terminal states, so this resulted
   in a hang.

2. This adds a retry if the target goroutine is in a transient state
   that prevents us from injecting a call. The most common failure
   mode here is that the target goroutine is in _Grunnable, but this
   was previously masked because it deadlocked the test.

3. Related to 2, this switches the "ready" signal from the target
   goroutine from a blocking channel send to a non-blocking channel
   send. This makes it much less likely that we'll catch this
   goroutine while it's in the runtime performing that send.

4. This increases GOMAXPROCS from 2 to 8 during these tests. With the
   current setting of 2, we can have at most the non-preemptible
   goroutine we're injecting a call in to and the goroutine that's
   trying to make it exit. If anything else comes along, it can
   deadlock. One particular case I observed was in TestDebugCallGC,
   where runtime.GC() returns before the forEachP that prepares
   sweeping on all goroutines has finished. When this happens, the
   forEachP blocks on the non-preemptible loop, which means we now
   have at least three goroutines that need to run.

Fixes #25519.

Updates #29124.

Change-Id: I7bc41dc0b865b7d0bb379cb654f9a1218bc37428
Reviewed-on: https://go-review.googlesource.com/c/154112
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2018-12-17 03:00:28 +00:00
Agniva De Sarker
e167587dd6 go/doc: handle Examples with no body
Fixes #29271

Change-Id: Iff6a16c659ad6ec1b4d9559fcbcd40196086c60e
Reviewed-on: https://go-review.googlesource.com/c/154380
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-16 19:03:43 +00:00
Elias Naur
d50390ce72 cmd/fix,cmd/cgo,misc/cgo: map the EGLDisplay C type to uintptr in Go
Similar to to macOS' CF* types and JNI's jobject and derived types,
the EGLDisplay type is declared as a pointer but can contain
non-pointers (see #27054).
Fix it the same way: map EGLDisplay to uintptr in Go.

Fixes #27054

RELNOTE=yes

Change-Id: I6136f8f8162687c5493b30ed324e29efe55a8fd7
Reviewed-on: https://go-review.googlesource.com/c/154417
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-12-15 19:27:41 +00:00
Jordan Rhee
26985ed4a5 cmd/nm: report windows/arm as relocatable in TestGoExec
Updates #26148

Change-Id: I704efafca39e4397caf2db0146d83d309c761dd1
Reviewed-on: https://go-review.googlesource.com/c/154357
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-15 04:18:21 +00:00
Shenghou Ma
281ce28c50 cmd/link: fix in-package syso linking
CL 146297 ignored archive members with short names that don't have
the .o suffix, however, it also ignored .syso files as well.
This change restores the original .syso behavior and adds a test.

As the test is basically following a shell script, we make use of
the existing cmd/go/testdata/script framework. To support running
C compiler in the script, we added a `cc` command, which runs the
C compiler along with correct platform specific arguments.

Fixes #29253.

Change-Id: If8520151c4d6a74ab9fe84d34bff9a4480688815
Reviewed-on: https://go-review.googlesource.com/c/154109
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-12-15 01:38:39 +00:00
Bryan C. Mills
fd323a8cff cmd/go/internal/cache: save more data from DefaultDir
cmd/go/main.go sets GOCACHE explicitly, so if we don't save some
metadata about how DefaultDir arrived at its answer we will be unable
to reconstruct it later.

Fixes #29243

Change-Id: Ic8bb859ab045a29c91f6a4527e65aedabf874d53
Reviewed-on: https://go-review.googlesource.com/c/154309
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-12-15 00:17:57 +00:00
Filippo Valsorda
47713567d9 doc: document Go 1.11.4
Change-Id: Ic098bd69fa9e3f7b2ed6c451a7a266167c0cde94
Reviewed-on: https://go-review.googlesource.com/c/154302
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-12-14 21:47:13 +00:00
Filippo Valsorda
84bf9ce1fb doc: document Go 1.10.7
Change-Id: Id71aad4cf6149e0ba15f7fec0b74517827c37866
Reviewed-on: https://go-review.googlesource.com/c/154303
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-12-14 21:46:51 +00:00
Brad Fitzpatrick
b875991a49 net/http/httptest: don't register a flag unless it looks like it's in use
We shouldn't pollute people's flags with this debugging flag that was
never really meant to be public. It's certainly not documented.

So keep it for now, but don't register it unless it looks like it's in
use (by looking at os.Args). Kinda gross, but less gross than before.

Fixes #28619

Change-Id: I47498948a26a71ff36f9658a6d9dac73fd0a3016
Reviewed-on: https://go-review.googlesource.com/c/154217
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-12-14 19:56:15 +00:00
Brad Fitzpatrick
dbd323bb88 internal/x/net/http2/hpack: update from upstream
Updates to x/net git rev 891ebc4b82d6e74f468c533b06f983c7be918a96 for:

   http2/hpack: track the beginning of a header block
   https://go-review.googlesource.com/c/153978

Updates golang/go#29187

Change-Id: Ie2568b3f8d6aaa3f097a4ac25d3acdc794f5ff5c
Reviewed-on: https://go-review.googlesource.com/c/154118
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2018-12-14 18:15:56 +00:00
Bryan C. Mills
47fb1fbd55 cmd/go/internal/get: move wildcard-trimming to before CheckImportPath
Previously, RepoRootForImportPath trimmed certain "..." wildcards from
package patterns (even though its name suggests that the argument must
be an actual import path). It trimmed at the first path element that
was literally "..." (although wildcards in general may appear within a
larger path element), and relied on a subsequent check in
RepoRootForImportPath to catch confusing resolutions.

However, that causes 'go get' with wildcard patterns in fresh paths to
fail as of CL 154101: a wildcard pattern is not a valid import path,
and fails the path check. (The existing Test{Vendor,Go}Get* packages
in go_test.go and vendor_test.go catch the failure, but they are all
skipped when the "-short" flag is set — including in all.bash — and we
had forgotten to run them separately.)

We now trim the path before any element that contains a wildcard, and
perform the path check (and repo resolution) on only that prefix. It
is possible that the expanded path after fetching the repo will be
invalid, but a repository can contain directories that are not valid
import paths in general anyway.

Fixes #29241

Change-Id: I70fb2f7fc6603b7d339fd6c02e8cdeacfc93fc4b
Reviewed-on: https://go-review.googlesource.com/c/154108
Reviewed-by: Russ Cox <rsc@golang.org>
2018-12-14 16:18:51 +00:00
Clément Chigot
976bab6003 syscall: remove linknames to runtime symbols for aix/ppc64
Replaces //go:linkname by assembly functions for syscall
functions on aix/ppc64.
Since the new runtime internal ABI, this was triggering an error if
syscall.Syscall6 was called by others packages like x/sys/unix.
This commit should remove every future occurences of this problem.

Fixes #28769

Change-Id: I6a4bf77472ee1e974bdb76b27e74275e568f5a76
Reviewed-on: https://go-review.googlesource.com/c/153997
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-12-14 09:10:02 +00:00
Martin Möhrmann
38e7177c94 cmd/compile: fix length overflow when appending elements to a slice
Instead of testing len(slice)+numNewElements > cap(slice) use
uint(len(slice)+numNewElements) > uint(cap(slice)) to test
if a slice needs to be grown in an append operation.

This prevents a possible overflow when len(slice) is near the maximum
int value and the addition of a constant number of new elements
makes it overflow and wrap around to a negative number which is
smaller than the capacity of the slice.

Appending a slice to a slice with append(s1, s2...) already used
a uint comparison to test slice capacity and therefore was not
vulnerable to the same overflow issue.

Fixes: #29190

Change-Id: I41733895838b4f80a44f827bf900ce931d8be5ca
Reviewed-on: https://go-review.googlesource.com/c/154037
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-14 05:48:18 +00:00