Normal shift rules plus constant folding are enough to generate
efficient shift-by-constant instructions.
Add test to make sure we don't generate comparisons for constant
shifts.
TODO: there are still constant shift rules on PPC64. If they
are removed, the constant folding rules are not enough to remove
all the test and mask stuff for constant shifts. Leave them in
for now.
Chris Ball [Thu, 25 May 2017 19:48:02 +0000 (15:48 -0400)]
runtime: add symbols for Linux syscall numbers on 386/amd64
Matches other architectures by using names for syscalls instead of
numbers directly.
Fixes #20499.
Change-Id: I63d606b0b1fe6fb517fd994a7542a3f38d80dd54
Reviewed-on: https://go-review.googlesource.com/44213
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hiroshi Ioka [Tue, 23 May 2017 14:01:08 +0000 (23:01 +0900)]
cmd/cgo: support niladic function-like macros
Currently, cgo supports only macros which can be reduced to constants
or variables. The CL addresses remaining parts, macros which can be
represented as niladic functions.
The basic idea is simple:
1. make a thin wrapper function per macros.
2. replace macro expansions with function calls.
Fixes #10715
Fixes #18720
Change-Id: I150b4fb48e9dc4cc34466ef6417c04ac93d4bc1a
Reviewed-on: https://go-review.googlesource.com/43970
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Sat, 26 Aug 2017 09:12:56 +0000 (02:12 -0700)]
archive/tar: minor doc fixes
Use "file" consistently instead of "entry".
Change-Id: Ia81c9665d0d956adb78f7fa49de40cdb87fba000
Reviewed-on: https://go-review.googlesource.com/60150 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Fri, 25 Aug 2017 23:48:46 +0000 (16:48 -0700)]
archive/tar: require opt-in to PAX or GNU format for time features
Nearly every Header obtained from FileInfoHeader via the FS has
timestamps with sub-second resolution and the AccessTime
and ChangeTime fields populated. This forces the PAX format
to almost always be used, which has the following problems:
* PAX is still not as widely supported compared to USTAR
* The PAX headers will occupy at minimum 1KiB for every entry
The old behavior of tar Writer had no support for sub-second resolution
nor any support for AccessTime or ChangeTime, so had neither problem.
Instead the Writer would just truncate sub-second information and
ignore the AccessTime and ChangeTime fields.
In this CL, we preserve the behavior such that the *default* behavior
would output a USTAR header for most cases by truncating sub-second
time measurements and ignoring AccessTime and ChangeTime.
To use either of the features, users will need to explicitly specify
that the format is PAX or GNU.
The exact policy chosen is this:
* USTAR and GNU may still be chosen even if sub-second measurements
are present; they simply truncate the timestamp to the nearest second.
As before, PAX uses sub-second resolutions.
* If the Format is unspecified, then WriteHeader ignores AccessTime
and ChangeTime when using the USTAR format.
This ensures that USTAR may still be chosen for a vast majority of
file entries obtained through FileInfoHeader.
Updates #11171
Updates #17876
Change-Id: Icc5274d4245922924498fd79b8d3ae94d5717271
Reviewed-on: https://go-review.googlesource.com/59230
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Marvin Stenger [Wed, 30 Aug 2017 11:52:12 +0000 (13:52 +0200)]
runtime/internal/sys: use standard generated code header
This change implements the convention for generated code header agreed upon in https://golang.org/s/generatedcode.
Additionally run go generate.
Also update some comments.
Updates #13560
Change-Id: If45f91b93aaa0d43280c2c4630823bc4d2dc7d3a
Reviewed-on: https://go-review.googlesource.com/60250
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Stapelberg [Wed, 30 Aug 2017 14:50:13 +0000 (07:50 -0700)]
context: fix lint warning “drop = 0 from declaration”
Previously, the suggested code would result in the following golint warning:
“should drop = 0 from declaration of var errorsOnlyKey; it is the zero value”
Change-Id: I1a302c1e40ca89acbc76897e39097ecd04865460
Reviewed-on: https://go-review.googlesource.com/60290 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ilya Tocar [Wed, 23 Aug 2017 16:08:56 +0000 (11:08 -0500)]
cmd/compile/internal/ssa: remove redundant zeroextensions on amd64
Some instructions operating on <= 32 bits also zero out upper 32bits.
Remove zeroextensions of such values. Triggers a few times during
all.bash. Also removes ugly code like:
MOVL CX,CX
griesemer [Tue, 29 Aug 2017 13:48:07 +0000 (15:48 +0200)]
doc: minor clarification regarding the sharing of underlying arrays
The last sentence in the section on slice expressions could be read
as if it might apply to strings. Changed the sentence a bit to
emphasize its applicability to slices only. See also the issue for
more background.
Fixes #19220.
Change-Id: I8551f34230e4ed93f951e7b871cc81f54a5874a9
Reviewed-on: https://go-review.googlesource.com/59890 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ben Shi [Fri, 25 Aug 2017 12:07:01 +0000 (12:07 +0000)]
cmd/compile: optimize ARM with MULS
MULS was introduced in ARMv7 and corresponding to MULA. This patch
duplicated all MULA related SSA rules with MULS.
Here was the contrast test result against the original go compiler.
There was no improvement in total, but big improvement in special cases.
1. A specific test case accelerated 18.62%.
(https://github.com/benshi001/ugo1/blob/master/mulsub_test.go)
name old time/op new time/op delta
MulSub-4 270µs ± 0% 219µs ± 0% -18.62% (p=0.000 n=35+40)
2. Total size of all .a files in pkg/ shrank by 0.002%.
Martin Möhrmann [Tue, 29 Aug 2017 19:16:28 +0000 (21:16 +0200)]
cmd/compile: avoid padding for indirect map key or value on amd64p32
Padding needed for map buckets is dependent on the types used to
construct the map bucket. In case of indirect keys or values pointers
are used in the map bucket to the keys or values.
Change the map bucket padding calculation to take the alignment of
the key and value types used to construct the map bucket into account
instead of the original key and value type.
Since pointers are always 32bit aligned on amd64p32 this prevents
adding unneeded padding in case the key or value would have needed
64bit alignment without indirect referencing.
Change-Id: I7943448e882d269b5cff7e921a2a6f3430c50878
Reviewed-on: https://go-review.googlesource.com/60030 Reviewed-by: Keith Randall <khr@golang.org>
Alex Brainman [Tue, 29 Aug 2017 03:30:17 +0000 (13:30 +1000)]
cmd/link: unexport all peSection fields
Change-Id: I83e168f0d1dd1897a0c02c0f1233e1054e93fb0f
Reviewed-on: https://go-review.googlesource.com/59791 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Tue, 29 Aug 2017 03:09:59 +0000 (13:09 +1000)]
cmd/link: introduce and use peFile.addDWARF
Change-Id: I2c217e03779772605aa0b5a33ef80459333eeebc
Reviewed-on: https://go-review.googlesource.com/59790 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hiroshi Ioka [Mon, 28 Aug 2017 06:00:49 +0000 (15:00 +0900)]
cmd/link: refactor container()
* rename to emitPcln because I'd like to skip not only container types,
but also something like "go.buildid" in the future.
* return bool instead of int.
Change-Id: I029adb81292f7dd2fe98e69f3877c5c27f32ec30
Reviewed-on: https://go-review.googlesource.com/59415 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Mon, 28 Aug 2017 23:25:56 +0000 (16:25 -0700)]
archive/tar: populate uname/gname/devmajor/devminor in FileInfoHeader
We take a best-effort approach since information for these fields
are not well supported on all platforms.
user.LookupId+user.LookupGroupId is currently 15x slower than os.Stat.
For performance reasons, we perpetually cache username and groupname
with a sync.Map. As a result, this function will not be updated whenever
the user or group names are renamed in the OS. However, this is a better
situation than before, where those fields were not populated at all.
Change-Id: I3cec8291aed7675dea89ee1cbda92bd493c8831f
Reviewed-on: https://go-review.googlesource.com/59531
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Luca Bruno [Thu, 15 Jun 2017 11:35:43 +0000 (11:35 +0000)]
syscall: drop dummy byte for oob in unixgram SendmsgN
This commit relaxes SendmsgN behavior of introducing a dummy 1-byte
payload when sending ancillary-only messages.
The fake payload is not needed for SOCK_DGRAM type sockets, and actually
breaks interoperability with other fd-passing software (journald is one
known example). This introduces an additional check to avoid injecting
dummy payload in such case.
Full reference at https:/golang.org/issue/6476#issue-51285243
Fixes #6476
Change-Id: I19a974b4e7920e002bd0556259ab766572358520
Reviewed-on: https://go-review.googlesource.com/45872 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Mon, 28 Aug 2017 06:07:19 +0000 (15:07 +0900)]
cmd/link: remove dead code
Change-Id: I8a54235c8b7bf1010f19d0d358cd4f76fc911d28
Reviewed-on: https://go-review.googlesource.com/59416 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Mon, 28 Aug 2017 05:57:47 +0000 (14:57 +0900)]
cmd/link: unexport Elfadddynsym
Change-Id: Ifc66bd8c32e788f35da3bd105bcdcfd04bd3dabc
Reviewed-on: https://go-review.googlesource.com/59414 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Hiroshi Ioka [Mon, 28 Aug 2017 06:10:25 +0000 (15:10 +0900)]
cmd/link: refactor addlib
* extract pkgname() and findlib() from the function for #18190.
* rename const pkgname to const pkgdef to avoid confliction.
Change-Id: Ie62509bfbddcf19cf92b5b12b598679a069e6e74
Reviewed-on: https://go-review.googlesource.com/59417 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Right now we only kind of sort of trace GC STW events. We emit events
around mark termination, but those start well after stopping the world
and end before starting it again, and we don't emit any events for
sweep termination.
Fix this by generalizing EvGCScanStart/EvGCScanDone. These were
already re-purposed to indicate mark termination (despite the names).
This commit renames them to EvGCSTWStart/EvGCSTWDone, adds an argument
to indicate the STW reason, and shuffles the runtime to generate them
right before stopping the world and right after starting the world,
respectively.
These events will make it possible to generate precise minimum mutator
utilization (MMU) graphs and could be useful in detecting
non-preemptible goroutines (e.g., #20792).
Change-Id: If95783f370781d8ef66addd94886028103a7c26f
Reviewed-on: https://go-review.googlesource.com/55411 Reviewed-by: Rick Hudson <rlh@golang.org>
Guilherme Rezende [Tue, 29 Aug 2017 16:14:05 +0000 (13:14 -0300)]
mime: ignore key on ParseMediaType when value don't pass RFC 2231 check
Also add more test cases.
Change-Id: I53cc6484b25560fc7a4b5d44e73bbd9270c25769
Reviewed-on: https://go-review.googlesource.com/59950 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Daniel Martí [Mon, 21 Aug 2017 20:23:14 +0000 (22:23 +0200)]
all: join some chained ifs to unindent code
Found with mvdan.cc/unindent. It skipped the cases where parentheses
would need to be added, where comments would have to be moved elsewhere,
or where actions and simple logic would mix.
One of them was of the form "err != nil && err == io.EOF", so the first
part was removed.
Change-Id: Ie504c2b03a2c87d10ecbca1b9270069be1171b91
Reviewed-on: https://go-review.googlesource.com/57690
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Rob Pike [Tue, 29 Aug 2017 03:46:38 +0000 (13:46 +1000)]
flag: document that custom usage functions are free to call os.Exit
Some custom usage functions call it for clarity; others rely on the default
behavior, which makes an explicit call redundant. Document that it's
safe to be explicit.
Fixes #21671.
Change-Id: I08e9f47265582821cfd35995dff0c589cd85809d
Reviewed-on: https://go-review.googlesource.com/59792 Reviewed-by: Dominik Honnef <dominik@honnef.co> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Elias Naur [Tue, 29 Aug 2017 09:03:30 +0000 (11:03 +0200)]
runtime: call sigtrampgo on solaris
CL 57291 broke on solaris because it depends on signal forwarding
working for signals raised by dieFromSignal.
Call sigtrampgo instead of sighandler directly, like the other
unix platforms.
Fixes the solaris builders.
Change-Id: I6bf314c436d1edeaecc4b03f15a9155270919524
Reviewed-on: https://go-review.googlesource.com/59811
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hiroshi Ioka [Tue, 29 Aug 2017 08:28:15 +0000 (17:28 +0900)]
cmd/cgo: update documentation on implementation details
Change-Id: Iec771d5bbdf510b6c5ec17a614da90e7974a6348
Reviewed-on: https://go-review.googlesource.com/59870 Reviewed-by: Ian Lance Taylor <iant@golang.org>
André Carvalho [Tue, 25 Jul 2017 22:18:58 +0000 (19:18 -0300)]
runtime/trace: add example about trace.Start/Stop
This commit adds an example to the runtime/trace package
on how to use the trace.Start and trace.Stop functions
to trace the execution of a Go program and write
its trace output to a file.
Change-Id: Idf920398f1c3b9d185af9df5ce9293f2361db022
Reviewed-on: https://go-review.googlesource.com/51170 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Carlos Eduardo Seo [Tue, 16 May 2017 21:55:54 +0000 (16:55 -0500)]
cmd/asm, cmd/internal/obj/ppc64: add ISA 3.0 instructions
This change adds new ppc64 instructions from the POWER9 ISA. This includes
compares, loads, maths, register moves and the new random number generator and
copy/paste facilities.
Elias Naur [Sat, 19 Aug 2017 14:59:19 +0000 (16:59 +0200)]
runtime: forward crashing signals to late handlers
CL 49590 made it possible for external signal handlers to catch
signals from a crashing Go process. This CL extends that support
to handlers registered after the Go runtime has initialized.
Updates #20392 (and possibly fix it).
Change-Id: I18eccd5e958a505f4d1782a7fc51c16bd3a4ff9c
Reviewed-on: https://go-review.googlesource.com/57291
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:52:11 +0000 (13:52 +1000)]
cmd/link: introduce and use peFile.writeOptionalHeader
Change-Id: I27b33f2425281bc1790528ae514d99a468ad7fce
Reviewed-on: https://go-review.googlesource.com/59429 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:49:15 +0000 (13:49 +1000)]
cmd/link: introduce and use peFile.dataDirectory
Change-Id: I61f64287a488ed82e71639540697b6ade5a0426a
Reviewed-on: https://go-review.googlesource.com/59428 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:45:56 +0000 (13:45 +1000)]
cmd/link: introduce and use peFile.writeFileHeader
Change-Id: I1324b69ab9edb870589197fa601b5764634d42a4
Reviewed-on: https://go-review.googlesource.com/59427 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:42:06 +0000 (13:42 +1000)]
cmd/link: introduce and use peFile.writeSymbolTableAndStringTable
Change-Id: I506f5e146f3b5bf359d6932a85ac5572d3a3f103
Reviewed-on: https://go-review.googlesource.com/59426 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:39:19 +0000 (13:39 +1000)]
cmd/link: introduce and use peFile.writeSymbols
Change-Id: If629b19cebc6ae8dfbf603dcd7f2dd3d0046a935
Reviewed-on: https://go-review.googlesource.com/59425 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:35:21 +0000 (13:35 +1000)]
cmd/link: simplify writePESymTableRecords
Change-Id: I2da982fdef826aaecb86431f7d80ffc0fb2c4337
Reviewed-on: https://go-review.googlesource.com/59424 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:32:19 +0000 (13:32 +1000)]
cmd/link: introduce and use peFile.mapToPESection
Change-Id: I598e9da5587908f39faa13c11d2b42054f5a632d
Reviewed-on: https://go-review.googlesource.com/59423 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:29:28 +0000 (13:29 +1000)]
cmd/link: introduce and use peFile.writeSymbol
Change-Id: I9fcae7bfd647b52d9b4f36f04710ba7921609c02
Reviewed-on: https://go-review.googlesource.com/59422 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:25:45 +0000 (13:25 +1000)]
cmd/link: move perelocsect into peFile.emitRelocations (no code changed)
Change-Id: I807412bd743d544195aaf9d720f81b128b4636b3
Reviewed-on: https://go-review.googlesource.com/59421 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:18:03 +0000 (13:18 +1000)]
cmd/link: introduce peFile.ctorsSect and use it in peFile.emitRelocations
Change-Id: I65058c150a19aa4e3083fd8754d08ea23721844b
Reviewed-on: https://go-review.googlesource.com/59420 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:14:43 +0000 (13:14 +1000)]
cmd/link: introduce and use peFile.emitRelocations
Change-Id: I2458d1391af063d99ba1e446bcf12f7c41ae5f6b
Reviewed-on: https://go-review.googlesource.com/59419 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 28 Aug 2017 03:04:27 +0000 (13:04 +1000)]
cmd/link: introduce and use peSection.emitRelocations
Change-Id: I2bebee5566ee07786695f147c27661e69337a0f7
Reviewed-on: https://go-review.googlesource.com/59418 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hiroshi Ioka [Sun, 27 Aug 2017 10:09:18 +0000 (19:09 +0900)]
cmd/link: fix warning for buildmode=plugin on darwin/amd64
Without this CL, the system linker complains about absolute addressing
in type..eqfunc.*.
Updates #18190
Change-Id: I68db37a7f4c96b16a9c13baffc0f043a3048df6d
Reviewed-on: https://go-review.googlesource.com/59373 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Mon, 28 Aug 2017 22:39:57 +0000 (07:39 +0900)]
cmd/cgo: avoid using common names for sniffing
Current code uses names like "x" and "s" which can conflict with user's
code easily. Use cryptographic names.
Fixes #21668
Change-Id: Ib6d3d6327aa5b92d95c71503d42e3a79d96c8e15
Reviewed-on: https://go-review.googlesource.com/59710 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall [Mon, 28 Aug 2017 19:57:52 +0000 (12:57 -0700)]
cmd/compile: avoid generating large offsets
The assembler barfs on large offsets. Make sure that all the
instructions that need to have their offsets in an int32
1) check on any rule that computes offsets for such instructions
2) change their aux fields so the check builder checks it.
The assembler also silently misassembled offsets between 1<<31
and 1<<32. Add a check in the assembler to barf on those as well.
Fixes #21655
Change-Id: Iebf24bf10f9f37b3ea819ceb7d588251c0f46d7d
Reviewed-on: https://go-review.googlesource.com/59630
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Tom Bergan [Mon, 28 Aug 2017 18:09:37 +0000 (11:09 -0700)]
doc/1.9: add mention of net/http.LocalAddrContextKey
Fixes #21603
Change-Id: I42fb7ea2dd7f6d6a201171055beaeda68c26b823
Reviewed-on: https://go-review.googlesource.com/59530 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Fraenkel [Thu, 22 Jun 2017 01:58:42 +0000 (21:58 -0400)]
net/http: Set a timeout on Request.Context when using TimeoutHandler
In TimeoutHandler, use a request whose context has been configured with
the handler's timeout
Fixes #20712
Change-Id: Ie670148f85fdad46841ff29232042309e15665ae
Reviewed-on: https://go-review.googlesource.com/46412
Run-TryBot: Tom Bergan <tombergan@google.com> Reviewed-by: Tom Bergan <tombergan@google.com>
Ilya Tocar [Wed, 9 Aug 2017 18:43:34 +0000 (13:43 -0500)]
cmd/compile/internal/ssa: Mark ADD[Q|L]const as rematerializeable
We can rematerialize only ops that have SP or SB as their only argument.
There are some ADDQconst(SP) that can be rematerialized, but are spilled/filled instead,
so mark addconst as rematerializeable. This shaves ~1kb from go tool.
Artyom Pervukhin [Sun, 27 Aug 2017 08:30:19 +0000 (11:30 +0300)]
net/http: mention RegisterOnShutdown in Server.Shutdown docs
Closes #21637
Change-Id: Icc3528572ea2a25e62757cc8fbbb9c3fa96a78b2
Reviewed-on: https://go-review.googlesource.com/59350 Reviewed-by: Tom Bergan <tombergan@google.com>
Ben Shi [Thu, 24 Aug 2017 10:51:34 +0000 (10:51 +0000)]
cmd/compile: optimize ARM with more efficient MOVB/MOVBU/MOVH/MOVHU
Like the indexed MOVW (MOVWloadidx/MOVWstoreidx) used in current
ARM backend, the indexed MOVB/MOVBU/MOVH/MOVHU can also be used to
generate further optimized ARM code.
My patch implements this optimization. Here are some contrast test
results against the original go compiler.
1. The total size of all .a files in pkg/ shrinks by 0.03%.
Matej Baćo [Mon, 28 Aug 2017 10:41:27 +0000 (12:41 +0200)]
regexp: examples for Regexp.Expand and Regexp.ExpandString functions
Current documentation lacks simple examples for functions Regexp.Expand
and Regexp.ExpandString whose usage is unclear from description alone.
This commit adds examples that demonstrate usage in practical way.
Fixes #21649
Change-Id: I7b2c06c8ab747f69a6578f0595bf0f3c742ac479
Reviewed-on: https://go-review.googlesource.com/59470 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Sun, 27 Aug 2017 13:00:00 +0000 (22:00 +0900)]
cmd/link: refactor *reloc
* use bool instead of int if it's adequate.
* remove blank lines.
Change-Id: Ic4a5644a33ed9fc7ce388ef8ba15f1732446fcfc
Reviewed-on: https://go-review.googlesource.com/59375
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This has been supported since Go 1 and there's even a test for it.
The documentation was missing.
Fixes #21409.
Change-Id: I5813488f6a98c1b4506c239e968d43344b91be12
Reviewed-on: https://go-review.googlesource.com/59412 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Dmitri Shuralyov [Mon, 28 Aug 2017 03:17:12 +0000 (23:17 -0400)]
cmd/go/internal/load: fix IsMetaPackage function name in doc
The IsMetaPackage function was made exported when it was moved from
cmd/go to cmd/go/internal/load in CL 36196. Its documentation wasn't
updated accordingly. This change fixes that, resolving a golint issue.
Updates #18653.
Change-Id: Icf89461000754d0f09e6617b11c838e4c050d5a6
Reviewed-on: https://go-review.googlesource.com/59430 Reviewed-by: Dave Cheney <dave@cheney.net>
Joe Tsai [Fri, 25 Aug 2017 22:34:35 +0000 (15:34 -0700)]
archive/tar: improve package documentation
Many aspects of the package is woefully undocumented.
With the recent flurry of improvements, the package is now at feature
parity with the GNU and TAR tools. Thoroughly all of the public API
and perform some minor stylistic cleanup in some code segments.
Change-Id: Ic892fd72c587f30dfe91d1b25b88c9c8048cc389
Reviewed-on: https://go-review.googlesource.com/59210
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Fri, 25 Aug 2017 22:15:41 +0000 (15:15 -0700)]
archive/tar: add raw support for global PAX records
The PAX specification says the following:
<<<
'g' represents global extended header records for the following files in the archive.
The format of these extended header records shall be as described in pax Extended Header.
Each value shall affect all subsequent files that do not override that value
in their own extended header record and until another global extended header record
is reached that provides another value for the same field.
>>>
This CL adds support for parsing and composing global PAX records,
but intentionally does not provide support for automatically
persisting the global state across files.
Changes made:
* When Reader encounters a TypeXGlobalRecord header, it parses the
PAX records and returns them to the user ad-verbatim. Reader does not
store them in its state, ensuring it has no effect on future Next calls.
* When Writer receives a TypeXGlobalRecord header, it writes the
PAX records to the archive ad-verbatim. It does not store them in
its state, ensuring it has no effect on future WriteHeader calls.
* The restriction regarding empty record values is lifted since this
value is used to represent deletion in global headers.
Why provide raw support only:
* Some archives in the wild have a global header section (often empty)
and it is the user's responsibility to manually read and discard it's body.
The logic added here allows users to more easily skip over these sections.
* For users that do care about global headers, having access to the raw
records allows them to implement the functionality of global headers themselves
and manually persist the global state across files.
* We can still upgrade to a full implementation in the future.
Why we don't provide full support:
* Even though the PAX specification describes their operation in detail,
both the GNU and BSD tar tools (which are the most common implementations)
do not have a consistent interpretation of many details.
* Global headers were a controversial feature in PAX, by admission of the
specification itself:
<<<
The concept of a global extended header (typeflag g) was controversial.
The typeflag g global headers should not be used with interchange media that
could suffer partial data loss in transporting the archive.
>>>
* Having state persist from entry-to-entry complicates the implementation
for a feature that is not widely used and not well supported.
Change-Id: I1d904cacc2623ddcaa91525a5470b7dbe226c7e8
Reviewed-on: https://go-review.googlesource.com/59190 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
Daniel Martí [Wed, 9 Aug 2017 07:56:08 +0000 (16:56 +0900)]
testing: error if -parallel is given N<1
Otherwise, if there are any parallel tests, it will hang and panic with
"all goroutines are asleep - deadlock!".
Do not use flag.Uint to handle the error for us because we also want to
error on N==0, and because it would make setting the default to
GOMAXPROCS(0) more difficult, since it's an int.
Check for it right after flag.Parse, and mimic flag errors by printing
the usage and returning exit code 2.
Fixes #20542.
Change-Id: I0c9d4587f83d406a8f5e42ed74e40be46d639ffb
Reviewed-on: https://go-review.googlesource.com/54150
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Meir Fischer [Fri, 14 Jul 2017 02:51:08 +0000 (22:51 -0400)]
testing: ensure profiles are written upon -timeout panic
This addresses the case of a -timeout panic, but not the more
general case of a signal arriving. See CL 48370 and CL 44352
for recent difficulties in that area.
"-timeout" here means flag usage to distinguish from the
default timeout termination which uses signals.
Fixes #19394
Change-Id: I5452d5422c0c080e940cbcc8c6606049975268c6
Reviewed-on: https://go-review.googlesource.com/48491 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Joe Tsai [Thu, 24 Aug 2017 06:44:33 +0000 (23:44 -0700)]
archive/tar: support arbitrary PAX records
This CL adds the following new publicly visible API:
type Header struct { ...; PAXRecords map[string]string }
The new Header.PAXRecords field is a map of all PAX extended header records.
We suggest (but do not enforce) that users use VENDOR-prefixed keys
according to the following in the PAX specification:
<<<
The standard developers have reserved keyword name space for vendor extensions.
It is suggested that the format to be used is:
VENDOR.keyword
where VENDOR is the name of the vendor or organization in all uppercase letters.
>>>
When reading, the Header.PAXRecords is populated with all PAX records
encountered so far, including basic ones (e.g., "path", "mtime", etc).
When writing, the fields of Header will be merged into PAXRecords,
overwriting any records that may conflict.
Since PAXRecords is a more expressive feature than Xattrs and
is entirely a superset of Xattrs, we mark Xattrs as deprecated,
and steer users towards the new PAXRecords API.
The issue has a discussion about adding a Header.SetPAXRecord method
to help validate records and keep the Header fields in sync.
However, we do not include that in this CL since that helper
method can always be added in the future.
There is no support for global records.
Fixes #14472
Change-Id: If285a52749acc733476cf75a2c7ad15bc1542071
Reviewed-on: https://go-review.googlesource.com/58390
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>