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

34200 Commits

Author SHA1 Message Date
Dmitri Shuralyov
b793372125 time: fix documentation of Round, Truncate behavior for d <= 0
Saying that they return t unchanged is misleading, because they return
a modified t, stripped of any monotonic clock reading, as of Go 1.9.

Fixes #21485.

Change-Id: Icddf8813aed3d687fcefcd2fe542829438be6a0a
Reviewed-on: https://go-review.googlesource.com/56690
Reviewed-by: Avelino <t@avelino.xxx>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 17:16:15 +00:00
André Carvalho
f2c0531795 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>
2017-08-29 16:58:43 +00:00
Dmitry Vyukov
91b6425031 runtime: add comments to race annotations
Change-Id: Icfb68e73ac38d0a0acc0cda1e41f9e9c5b75ecf5
Reviewed-on: https://go-review.googlesource.com/58110
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 16:35:15 +00:00
Matthew Dempsky
3124439b3a cmd/compile: make more use of exported position information
Updates #19683.

Change-Id: I64b3b93a3ab14518a5376e1270bdd2a94bdd67ef
Reviewed-on: https://go-review.googlesource.com/59611
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-08-29 15:50:53 +00:00
Marvin Stenger
d30f99647a runtime: don't publish new itab table before growth is finished
This change could improve the hit rate on itabTable during growth.

While we are here patch comments to refer to existing functions.

Change-Id: I76f81c860a3d6107e077e7e3932550858a8b7651
Reviewed-on: https://go-review.googlesource.com/55912
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-29 13:06:39 +00:00
Carlos Eduardo Seo
526f3420c2 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.

Change-Id: Ife3720b90f5af184ff115bbcdcbce5c1302d39b6
Reviewed-on: https://go-review.googlesource.com/53930
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2017-08-29 12:28:38 +00:00
Aliaksandr Valialkin
6959087b1c cmd/vet: unexported Stringer and error fields cannot be formatted
According to CL 31817, fmt cannot invoke String or Error methods
on unexported struct fields.

Fixes #17798.

Change-Id: I0d516577298bc36daa9a94313c3874d64dc079e6
Reviewed-on: https://go-review.googlesource.com/44831
Reviewed-by: Rob Pike <r@golang.org>
2017-08-29 11:59:45 +00:00
Elias Naur
c3189cee71 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>
2017-08-29 07:40:19 +00:00
Michael Munday
176cd48e57 runtime: fix memhash64 on big endian systems
Fixes #21677.

Change-Id: I869dee5f43df5d87d86922681726297e3024c562
Reviewed-on: https://go-review.googlesource.com/59810
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 04:39:41 +00:00
Alex Brainman
b7397c8100 cmd/link: make it compile again (fixes build)
CL 59375 changed Reloc.Done to bool, but that change
got lost in pe.go while merging. Restore that change.

Change-Id: Ie5a89e85579cdc9282f504fefd56355cfeb49389
Reviewed-on: https://go-review.googlesource.com/59711
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-08-29 02:36:27 +00:00
Manish Goregaokar
29d11ef436 cmd/vet: add test that copylock catches copying a sync.Map
fixes #21635

Change-Id: I78716d47b6a930074e5394f7171d5f545dfba0bc
Reviewed-on: https://go-review.googlesource.com/59690
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 02:33:15 +00:00
Alex Brainman
ce54a0c10a 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>
2017-08-29 02:08:51 +00:00
Alex Brainman
cb3fe3aa0d 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>
2017-08-29 02:07:54 +00:00
Alex Brainman
ac9be2020b 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>
2017-08-29 02:07:11 +00:00
Alex Brainman
fe1ccc5b88 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>
2017-08-29 02:06:26 +00:00
Alex Brainman
2034297bdb 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>
2017-08-29 02:05:23 +00:00
Alex Brainman
84af5ea9b4 cmd/link: simplify writePESymTableRecords
Change-Id: I2da982fdef826aaecb86431f7d80ffc0fb2c4337
Reviewed-on: https://go-review.googlesource.com/59424
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:04:06 +00:00
Alex Brainman
6561e4b61c 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>
2017-08-29 02:01:26 +00:00
Alex Brainman
6f299c7f7e 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>
2017-08-29 02:00:21 +00:00
Alex Brainman
72967551e5 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>
2017-08-29 01:59:12 +00:00
Alex Brainman
64985505b0 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>
2017-08-29 01:58:10 +00:00
Alex Brainman
3558c16d48 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>
2017-08-29 01:57:05 +00:00
Alex Brainman
04d410d6cd 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>
2017-08-29 01:51:26 +00:00
Hiroshi Ioka
88a1e85c70 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>
2017-08-29 00:51:34 +00:00
Kunpei Sakai
5a6c332451 debug/macho: add missing file flags
Fixes #21414

Change-Id: I8b25d416e6ead087b4a9965e8fa1a7f59ff07291
Reviewed-on: https://go-review.googlesource.com/59290
Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 00:44:44 +00:00
Hiroshi Ioka
77acf19a59 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>
2017-08-29 00:42:34 +00:00
Matthew Dempsky
93471a1390 cmd/compile: merge tempnamel into tempAt
Passes toolstash-check.

Change-Id: I01ed1c04be5a23756742d461f13f1e587ea7ecb8
Reviewed-on: https://go-review.googlesource.com/59610
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-08-28 22:46:30 +00:00
Josh Bleecher Snyder
2dd1f87d38 cmd/compile: add Type.NumResults and friends
Passes toolstash-check.

Change-Id: Id62bacff13fbd30de62b925d97a4e7bee1c66120
Reviewed-on: https://go-review.googlesource.com/59331
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-28 22:42:57 +00:00
Rob Pike
e3442b4ee8 cmd/doc: search for packages in the two-arg case
When given one argument, as in

	go doc binary.BigEndian

doc would search for the package, but when given two, as in

	go doc binary BigEndian

it would not. Fix the inconsistency.

Fixes #18697
Fixes #18664

Change-Id: Ib59dc483e8d4f91e6061c77a5ec24d0a50e115f0
Reviewed-on: https://go-review.googlesource.com/59413
Reviewed-by: Aliaksandr Valialkin <valyala@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-28 22:15:58 +00:00
Keith Randall
053840dc00 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>
2017-08-28 22:02:59 +00:00
Hana Kim
0b4f4e0153 cmd/trace: add -d that prints parsed traces
This is useful when debugging the tool.

Some tweaks on logging: log the webserver address, log.Print instead
of log.Printf when possible.

Change-Id: Iaf71b6523b40dc13795511784d48eacf0f5a396a
Reviewed-on: https://go-review.googlesource.com/59570
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2017-08-28 20:40:49 +00:00
Martin Möhrmann
2a56b023af runtime: specialize memhash32 and memhash64
AMD64 with AES support disabled:
name                old time/op    new time/op    delta
MapPopulate/1         78.0ns ± 1%    75.5ns ± 1%   -3.17%  (p=0.000 n=10+9)
MapPopulate/10         764ns ± 2%     673ns ± 2%  -11.91%  (p=0.000 n=10+10)
MapPopulate/100       9.52µs ± 1%    8.54µs ± 1%  -10.37%  (p=0.000 n=8+10)
MapPopulate/1000       116µs ± 2%     103µs ± 1%  -10.40%  (p=0.000 n=10+8)
MapPopulate/10000     1.01ms ± 1%    0.90ms ± 1%  -10.70%  (p=0.000 n=10+10)
MapPopulate/100000    9.81ms ± 1%    8.67ms ± 2%  -11.54%  (p=0.000 n=10+10)

386 with AES support disabled:
name                old time/op    new time/op    delta
MapPopulate/1         95.3ns ± 1%    90.6ns ± 1%  -4.95%  (p=0.000 n=10+9)
MapPopulate/10         983ns ± 2%     912ns ± 1%  -7.18%  (p=0.000 n=10+10)
MapPopulate/100       11.9µs ± 2%    11.2µs ± 1%  -6.01%  (p=0.000 n=10+10)
MapPopulate/1000       140µs ± 1%     131µs ± 1%  -6.19%  (p=0.000 n=10+10)
MapPopulate/10000     1.26ms ± 2%    1.18ms ± 1%  -5.93%  (p=0.000 n=9+10)
MapPopulate/100000    12.1ms ± 2%    11.4ms ± 1%  -5.48%  (p=0.000 n=10+10)

Fixes #21539

Change-Id: Ice128c947c9a6a294800d6a5250d82045eb70b55
Reviewed-on: https://go-review.googlesource.com/59352
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-28 19:55:27 +00:00
Tom Bergan
75d7a02e86 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>
2017-08-28 19:21:54 +00:00
Josh Bleecher Snyder
dc10aeeff8 runtime: only clear key string's pointer in mapdelete_faststr
Change-Id: I0360d294868ec4423e4ae036009fac4e72425c9c
Reviewed-on: https://go-review.googlesource.com/59152
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-28 18:57:02 +00:00
Josh Bleecher Snyder
8adaf68570 runtime: remove t.indirectvalue handling in fast evacuation routines
Maps with indirect values use the generic map routines.

Change-Id: Ib211e93f1dacefb988ba3d279f92a13065168079
Reviewed-on: https://go-review.googlesource.com/59135
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-08-28 18:56:40 +00:00
Josh Bleecher Snyder
cf69867af4 runtime: speed up key copying in specialized evacuate routines
Similar to CL 59110.

Change-Id: Ia2858541c86a44b105eacbca9a46b1044632c5ca
Reviewed-on: https://go-review.googlesource.com/59134
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-28 18:55:47 +00:00
Josh Bleecher Snyder
0480bfe57f runtime: remove handling of indirect key types in evacuate_fastX
None of the mapfast key types are indirect.

Change-Id: I1fb2682257567ee69504082a6cdad63c99916671
Reviewed-on: https://go-review.googlesource.com/59133
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-08-28 18:55:17 +00:00
Josh Bleecher Snyder
db9f5917fc runtime: remove handling of non-reflexive key types in evacuate_fastX
All of the mapfast key types are reflexive.

Change-Id: I8595aed2a9d945cda1b5d08e2067dce0f1c0d585
Reviewed-on: https://go-review.googlesource.com/59132
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-08-28 18:54:54 +00:00
Josh Bleecher Snyder
3c182a12f7 runtime: replace t.keysize with fixed key size in evacuate_fastX
Change-Id: I89c3c3b21d7a4acbc49b14a52ac8d9a5861c0c39
Reviewed-on: https://go-review.googlesource.com/59131
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-08-28 18:54:21 +00:00
Josh Bleecher Snyder
4cf7f909c6 runtime: add specialized copies of growWork and evacuate
The newly added routines are exact copies of the generic routines,
except for the function names and that growWork_fastX calls evacuate_fastX.

Actual optimization will happen in subsequent CLs.
This is intended to ease reviewing.

Change-Id: I52ef7dd40b2bdfc9cba2496544c0604e6e71cf7f
Reviewed-on: https://go-review.googlesource.com/59130
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-28 18:00:03 +00:00
Michael Fraenkel
9e7b30b463 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>
2017-08-28 17:46:28 +00:00
Keith Randall
2b079c3c04 cmd/compile: use keyed struct for asm tests
Just to make it clearer which regexps are positive and which
regexps are negative.

Change-Id: Ia190e89be28048fcae2491506f552afad90a5f85
Reviewed-on: https://go-review.googlesource.com/59490
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-28 17:34:25 +00:00
Ilya Tocar
7dd279013b 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.

Change-Id: Ib4cf4fe5f2ec9d3d7e5f0f77f1193eba66ca2f08
Reviewed-on: https://go-review.googlesource.com/54393
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-28 17:30:40 +00:00
Karsten Köhler
9afec99dc2 sort: add examples for IntsAreSorted, Float64s and Float64sAreSorted
Change-Id: Ib4883470bd2271e546daea3156d4a48dd873aaa3
Reviewed-on: https://go-review.googlesource.com/57670
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-28 17:29:29 +00:00
Elias Naur
627d3a0b4c misc/ios,src/iostest.bash: support GOIOS_DEVICE_ID
When running multiple iOS builds on the same host, GOIOS_DEVICE_ID
is used to distinguish the devices. To improve support,

- Only restart the particular device when invoking iostest.bash
with the -restart flag.
- Make the exec wrapper lock file per-device.

For the iOS builder.

Change-Id: Id6f222981f25036399a43c3202a393dba89d87cb
Reviewed-on: https://go-review.googlesource.com/57970
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-28 16:37:25 +00:00
David du Colombier
adbfdfe377 cmd/compile: don't use MOVOstore for move on plan9/amd64
The SSA compiler currently generates MOVOstore instructions
to optimize 16 bytes moves on AMD64 architecture.

However, we can't use the MOVOstore instruction on Plan 9,
because floating point operations are not allowed in the
note handler.

We rely on the useSSE flag to disable the use of the
MOVOstore instruction on Plan 9 and replace it by two
MOVQstore instructions.

Fixes #21625

Change-Id: Idfefcceadccafe1752b059b5fe113ce566c0e71c
Reviewed-on: https://go-review.googlesource.com/59171
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-08-28 16:21:28 +00:00
Artyom Pervukhin
c875cea7ae 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>
2017-08-28 16:17:58 +00:00
Ben Shi
a2f22a6803 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%.

2. The compilecmp benchmark shows a little decline.
name        old time/op       new time/op       delta
Template          2.35s ± 1%        2.37s ± 3%  +0.94%  (p=0.006 n=19+19)
Unicode           1.33s ± 3%        1.33s ± 2%    ~     (p=0.158 n=20+18)
GoTypes           7.86s ± 2%        7.84s ± 1%    ~     (p=0.284 n=19+18)
Compiler          37.5s ± 1%        37.7s ± 2%    ~     (p=0.101 n=20+19)
SSA               83.4s ± 2%        83.6s ± 2%    ~     (p=0.231 n=20+20)
Flate             1.46s ± 2%        1.45s ± 1%    ~     (p=0.097 n=20+17)
GoParser          1.86s ± 2%        1.86s ± 4%    ~     (p=0.738 n=20+20)
Reflect           5.10s ± 1%        5.11s ± 1%    ~     (p=0.290 n=20+18)
Tar               1.78s ± 2%        1.77s ± 2%    ~     (p=0.166 n=19+20)
XML               2.61s ± 2%        2.61s ± 2%    ~     (p=0.665 n=19+19)
[Geo mean]        4.67s             4.68s       +0.16%

name        old user-time/op  new user-time/op  delta
Template          2.79s ± 3%        2.80s ± 2%    ~     (p=0.662 n=20+20)
Unicode           1.62s ± 3%        1.64s ± 4%    ~     (p=0.252 n=20+20)
GoTypes           9.58s ± 2%        9.62s ± 2%    ~     (p=0.250 n=20+20)
Compiler          46.2s ± 1%        46.2s ± 1%    ~     (p=0.602 n=20+19)
SSA                108s ± 1%         108s ± 2%    ~     (p=0.242 n=18+20)
Flate             1.69s ± 3%        1.69s ± 4%    ~     (p=0.470 n=20+20)
GoParser          2.16s ± 3%        2.20s ± 4%  +1.70%  (p=0.005 n=19+20)
Reflect           6.02s ± 2%        6.02s ± 2%    ~     (p=0.700 n=20+17)
Tar               2.11s ± 2%        2.11s ± 3%    ~     (p=0.480 n=18+20)
XML               3.07s ± 2%        3.11s ± 4%  +1.50%  (p=0.043 n=20+20)
[Geo mean]        5.61s             5.64s       +0.55%

name        old text-bytes    new text-bytes    delta
HelloSize         586kB ± 0%        586kB ± 0%    ~     (all equal)

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

name        old bss-bytes     new bss-bytes     delta
HelloSize        72.9kB ± 0%       72.9kB ± 0%    ~     (all equal)

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

3. The go1 benchmark shows improvement totally, and even more than 10%
improvement in the test case Revcomp. 
name                     old time/op    new time/op    delta
BinaryTree17-4              42.0s ± 1%     41.5s ± 1%   -1.32%  (p=0.000 n=39+40)
Fannkuch11-4                24.1s ± 1%     23.6s ± 0%   -2.38%  (p=0.000 n=40+40)
FmtFprintfEmpty-4           843ns ± 0%     839ns ± 1%   -0.46%  (p=0.000 n=33+40)
FmtFprintfString-4         1.44µs ± 1%    1.37µs ± 1%   -5.48%  (p=0.000 n=40+35)
FmtFprintfInt-4            1.44µs ± 1%    1.41µs ± 2%   -1.50%  (p=0.000 n=40+40)
FmtFprintfIntInt-4         2.07µs ± 1%    2.06µs ± 0%   -0.78%  (p=0.000 n=40+40)
FmtFprintfPrefixedInt-4    2.50µs ± 1%    2.33µs ± 1%   -6.85%  (p=0.000 n=40+40)
FmtFprintfFloat-4          4.36µs ± 1%    4.34µs ± 0%   -0.39%  (p=0.017 n=40+40)
FmtManyArgs-4              8.11µs ± 0%    8.00µs ± 0%   -1.37%  (p=0.000 n=40+40)
GobDecode-4                 105ms ± 2%     103ms ± 2%   -2.17%  (p=0.000 n=39+39)
GobEncode-4                90.1ms ± 2%    88.6ms ± 1%   -1.67%  (p=0.000 n=40+39)
Gzip-4                      4.18s ± 1%     4.09s ± 1%   -2.03%  (p=0.000 n=40+40)
Gunzip-4                    608ms ± 1%     603ms ± 1%   -0.86%  (p=0.000 n=40+34)
HTTPClientServer-4          674µs ± 3%     661µs ± 2%   -1.82%  (p=0.000 n=40+39)
JSONEncode-4                256ms ± 1%     243ms ± 0%   -5.11%  (p=0.000 n=39+31)
JSONDecode-4                915ms ± 1%     904ms ± 1%   -1.18%  (p=0.000 n=40+36)
Mandelbrot200-4            49.2ms ± 0%    49.3ms ± 0%     ~     (p=0.254 n=34+40)
GoParse-4                  46.9ms ± 2%    46.9ms ± 1%     ~     (p=0.737 n=40+39)
RegexpMatchEasy0_32-4      1.28µs ± 1%    1.27µs ± 1%   -0.71%  (p=0.000 n=40+40)
RegexpMatchEasy0_1K-4      7.86µs ± 4%    7.67µs ± 4%   -2.46%  (p=0.000 n=38+40)
RegexpMatchEasy1_32-4      1.28µs ± 1%    1.28µs ± 1%   -0.54%  (p=0.000 n=40+40)
RegexpMatchEasy1_1K-4      10.4µs ± 2%    10.3µs ± 2%   -0.88%  (p=0.003 n=40+39)
RegexpMatchMedium_32-4     2.05µs ± 0%    2.04µs ± 0%   -0.34%  (p=0.000 n=40+33)
RegexpMatchMedium_1K-4      541µs ± 1%     535µs ± 1%   -1.02%  (p=0.000 n=40+38)
RegexpMatchHard_32-4       29.3µs ± 1%    29.1µs ± 1%   -0.51%  (p=0.000 n=40+40)
RegexpMatchHard_1K-4        881µs ± 1%     871µs ± 1%   -1.15%  (p=0.000 n=40+40)
Revcomp-4                  81.7ms ± 2%    67.5ms ± 2%  -17.37%  (p=0.000 n=39+39)
Template-4                  1.05s ± 1%     1.08s ± 2%   +3.67%  (p=0.000 n=40+40)
TimeParse-4                7.24µs ± 1%    7.09µs ± 1%   -2.13%  (p=0.000 n=40+40)
TimeFormat-4               13.2µs ± 1%    13.1µs ± 0%   -0.31%  (p=0.007 n=40+31)
[Geo mean]                  733µs          718µs        -2.03%

name                     old speed      new speed      delta
GobDecode-4              7.28MB/s ± 2%  7.44MB/s ± 2%   +2.23%  (p=0.000 n=39+39)
GobEncode-4              8.52MB/s ± 2%  8.67MB/s ± 1%   +1.70%  (p=0.000 n=40+39)
Gzip-4                   4.65MB/s ± 1%  4.74MB/s ± 1%   +1.94%  (p=0.000 n=37+40)
Gunzip-4                 31.9MB/s ± 1%  32.2MB/s ± 1%   +0.90%  (p=0.000 n=40+36)
JSONEncode-4             7.57MB/s ± 1%  7.98MB/s ± 0%   +5.41%  (p=0.000 n=40+31)
JSONDecode-4             2.12MB/s ± 1%  2.15MB/s ± 1%   +1.23%  (p=0.000 n=40+40)
GoParse-4                1.23MB/s ± 1%  1.23MB/s ± 1%     ~     (p=0.769 n=39+40)
RegexpMatchEasy0_32-4    25.0MB/s ± 1%  25.2MB/s ± 1%   +0.71%  (p=0.000 n=40+40)
RegexpMatchEasy0_1K-4     130MB/s ± 5%   134MB/s ± 4%   +2.53%  (p=0.000 n=38+40)
RegexpMatchEasy1_32-4    24.9MB/s ± 1%  25.1MB/s ± 1%   +0.55%  (p=0.000 n=40+40)
RegexpMatchEasy1_1K-4    98.5MB/s ± 2%  99.4MB/s ± 2%   +0.88%  (p=0.003 n=40+39)
RegexpMatchMedium_32-4    490kB/s ± 0%   490kB/s ± 0%     ~     (all equal)
RegexpMatchMedium_1K-4   1.89MB/s ± 1%  1.91MB/s ± 1%   +1.02%  (p=0.000 n=40+38)
RegexpMatchHard_32-4     1.10MB/s ± 1%  1.10MB/s ± 0%   +0.41%  (p=0.000 n=40+33)
RegexpMatchHard_1K-4     1.16MB/s ± 1%  1.17MB/s ± 1%   +1.21%  (p=0.000 n=40+40)
Revcomp-4                31.1MB/s ± 2%  37.6MB/s ± 2%  +21.03%  (p=0.000 n=39+39)
Template-4               1.86MB/s ± 1%  1.79MB/s ± 1%   -3.51%  (p=0.000 n=40+38)
[Geo mean]               6.66MB/s       6.80MB/s        +2.13%

fixes #21492

Change-Id: Ia26e7ca393f0a5f31de240e8ff9a220453ca7e0d
Reviewed-on: https://go-review.googlesource.com/58450
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-28 16:10:27 +00:00
Matej Baćo
1fe1512f50 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>
2017-08-28 15:34:19 +00:00
Wei Xiao
c195deb48c cmd/internal/objfile: add arm64 disassembler support
Fixes #19157

Change-Id: Ieea286e8dc03929c3645f3113c33df569f8e26f3
Reviewed-on: https://go-review.googlesource.com/58930
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-28 14:09:35 +00:00