summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* fmt: optimize %x and %X formatting for byte slices and stringsMartin Möhrmann2016-03-032-44/+134
| | | | | | | | | | | | | | | | | | No extra buffering is needed to save the encoding since the left padding can be computed and written out before the encoding is generated. Add extra tests to both string and byte slice formatting. name old time/op new time/op delta SprintfHexString-2 410ns ± 3% 194ns ± 3% -52.60% (p=0.000 n=20+19) SprintfHexBytes-2 431ns ± 3% 202ns ± 2% -53.13% (p=0.000 n=18+20) Change-Id: Ibca4316427c89f834e4faee61614493c7eedb42b Reviewed-on: https://go-review.googlesource.com/20097 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
* cmd/compile: fix fieldtrack experimentKeith Randall2016-03-031-0/+5
| | | | | | | | | | | | | | | | | The ODOTPTRs introduced in CL #19814 don't have field names, just offsets. The fieldtrack experiment crashes when examining them. Instead, just ignore them. We'll never track these fields anyway. It would be nice to have the runtime type struct build in the compiler (like we do sudog, for example) so we could use its fieldnames. Doesn't seem worth it just for this CL. Change-Id: I5e75024f5a8333eb7439543b3f466ea40213a1b9 Reviewed-on: https://go-review.googlesource.com/20157 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: more lineno type conversionsMatthew Dempsky2016-03-033-4/+4
| | | | | | | | Change-Id: Ib0a116a78f61eafe88a0ea5dc6733750ae755fdf Reviewed-on: https://go-review.googlesource.com/20156 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: add Minalign field to ld.ArchMichael Munday2016-03-0314-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | The new Minalign field sets the minimum alignment for all symbols. This is required for the upcoming s390x port which requires symbols be 2-byte aligned for efficient relative addressing. All preexisting architectures have Minalign set to 1 which means that this commit should have no effect. I tested values of 2, 4 and 8 on linux amd64 and the tests appear to pass. Increasing Minalign to 16 appears to break the runtime. I think this is due to assumptions made about the layout of module data. toolstash -cmp on linux amd64 shows no changes due to this commit. Resolves #14604 Change-Id: I0fe042d52c4e4732eba5fabcd0c31102a2408764 Reviewed-on: https://go-review.googlesource.com/20149 Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: deduplicate TCP socket codeMikio Hara2016-03-0313-404/+325
| | | | | | | | | | | | | | | | This change consolidates functions and methods related to TCPAddr, TCPConn and TCPListener for maintenance purpose, especially for documentation. Also refactors Dial error code paths. The followup changes will update comments and examples. Updates #10624. Change-Id: I3333ee218ebcd08928f9e2826cd1984d15ea153e Reviewed-on: https://go-review.googlesource.com/20009 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: exit early if oldname doesn't find a nameRobert Griesemer2016-03-031-0/+1
| | | | | | Change-Id: I59ce1b40bc3472cc92a9a0a9fbd32342e0b945ad Reviewed-on: https://go-review.googlesource.com/20152 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/compile: remove more superfluous int(lineno) conversionsRobert Griesemer2016-03-0313-62/+58
| | | | | | | | Change-Id: Ia3e5d62b9d38a6c356baec8eb88b2bdabff5820f Reviewed-on: https://go-review.googlesource.com/20150 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Robert Griesemer <gri@golang.org>
* compress/bzip2: refactor unit testsJoe Tsai2016-03-037-399/+180
| | | | | | | | | | | | | | | | | | | Over the years as more bugs were discovered with the bzip2 library, new Tests were appended the unit tests and the tests became gnarly. Clean up the tests to be more consistent with modern Go style in addition to coalescing common tests into a general version that iterates over a list of input/output pairs. This has the advantage that the input, output, and test code are all in the same area, rather than being sprawled around the test file. There is no loss of test coverage. Change-Id: I377ed89378f0b89763d4a56ffc37b22d9c2a369e Reviewed-on: https://go-review.googlesource.com/20133 Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net: skip TestLookupPort on android with netgoBurcu Dogan2016-03-031-0/+4
| | | | | | | | | | | /etc/services is not available on Android. The pure Go implementation of LookupPort will never succeed on Android. Skipping the test. Updates #14576. Change-Id: I707ac24aea3f988656b95b1816ee5c9690106985 Reviewed-on: https://go-review.googlesource.com/20154 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* math: delete unused function sqrtCRob Pike2016-03-031-4/+0
| | | | | | | | | It appears to be a trivial dreg. Unreferenced. Gone. Change-Id: I4a5ceed48e84254bc8a07fdb04487a18a0edf965 Reviewed-on: https://go-review.googlesource.com/20122 Run-TryBot: Rob Pike <r@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
* cmd/compile: eliminate arch-specific typedefsMatthew Dempsky2016-03-039-115/+35
| | | | | | | | | | | | | Arch backends already provide us Widthint and Widthptr, which is ample information to figure out how to define the universal "int", "uint", and "uintptr" types. No need for providing a generic typedef mechanism beyond that. Change-Id: I35c0c17a67c80605a9208b93d77d6960b2cbb17d Reviewed-on: https://go-review.googlesource.com/20153 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* doc: add link to 1.6 release notes on golang.org/project pageChris Broadfoot2016-03-031-0/+1
| | | | | | | | Fixes #14378. Change-Id: I680b523c01576e42f1dbda9131d1f6bb99b3668b Reviewed-on: https://go-review.googlesource.com/20138 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/link: pack LSym boolean attributesDavid Crawshaw2016-03-0320-253/+283
| | | | | | | | | | | | | No performance improvement, but possibly more readable. Linking juju: tip: real 0m5.470s user 0m6.131s this: real 0m5.392s user 0m6.087s Change-Id: I578e94fbe6c11b19d79034c33b3db31d9689d439 Reviewed-on: https://go-review.googlesource.com/20108 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: David Crawshaw <crawshaw@golang.org>
* cmd/link: stop generating garbage in elfhashBrad Fitzpatrick2016-03-031-11/+7
| | | | | | | | | | | | | All callers already had strings. No need to generate byte slice copies to work on bytes. Performance not measured, but probably helps at least a bit. Change-Id: Iec3230b69724fac68caae7aad46f2ce1504e82e5 Reviewed-on: https://go-review.googlesource.com/20136 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* misc/cgo/test: rewrite windows version of mysleepAlex Brainman2016-03-022-21/+1
| | | | | | | | | | | | | Latest version of gcc (tdm-1) 5.1.0 refuses to compile our code on windows/386 (see issue for details). Rewrite the code. Fixes #14328 Change-Id: I70f4f063282bd2958cd2175f3974369dd49dd8dc Reviewed-on: https://go-review.googlesource.com/20008 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: make Allsym a sliceDavid Crawshaw2016-03-0210-39/+29
| | | | | | | | | | | | | | | | Looks a tiny bit faster, which is a surprise. Probably noise. Motivation is making the LSym structure a little easier to understand. Linking juju, best of 10: before: real 0m4.811s user 0m5.582s after: real 0m4.611s user 0m5.267s Change-Id: Idbedaf4a6e6e199036a1bbb6760e98c94ed2c282 Reviewed-on: https://go-review.googlesource.com/20142 Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Run-TryBot: David Crawshaw <crawshaw@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile/internal/gc: export & import function bodies, but don't hook upRobert Griesemer2016-03-025-149/+707
| | | | | | | | | | | | | | | | | Function bodies are not yet hooked up because the node structure is not 100% correct. This commit establishes that we can correctly write bodies out and read them in again. - export and import all exported inlined function bodies: (export GO_GCFLAGS="-newexport"; sh all.bash) working - inlined functions are not yet hooked up (just dropped on the floor) - improved tracing output and error messages - make mkbuiltin.go work for both textual and binary export data so we can run tests with the new format Change-Id: I70dc4de419df1b604389c3747041d6dba8730b0b Reviewed-on: https://go-review.googlesource.com/16284 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/link: replace custom hashmap in DWARF writerDavid Crawshaw2016-03-021-47/+7
| | | | | | | | | | | | | | Also stop creating a map for each symbol, as it does not seem to help. Linking juju: tip: real 0m5.470s user 0m6.131s this: real 0m4.811s user 0m5.582s Change-Id: Ib3d931c996396a00942581770ff32df1eb8d6615 Reviewed-on: https://go-review.googlesource.com/20140 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: trunc(and(x,K)) rewrite to trunc(x) for some KDavid Chase2016-03-022-0/+121
| | | | | | | | | | uint8(s.b & 0xff) ought to produce same code as uint8(s.b) but it did not. RLH found this one looking for moles to whack in the GC code. Change-Id: I883d68ec7a5746d652712be84a274a11256b3b33 Reviewed-on: https://go-review.googlesource.com/20141 Reviewed-by: Keith Randall <khr@golang.org>
* cmd/compile: remove missed int(lineno) conversionsRobert Griesemer2016-03-021-9/+9
| | | | | | | | | | Follow-up to https://go-review.googlesource.com/20131 . Change-Id: Id8351fa39f24e6ea488cdbfcb855b69a31ffff31 Reviewed-on: https://go-review.googlesource.com/20134 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* fmt: optimize string truncationMartin Möhrmann2016-03-022-5/+14
| | | | | | | | | | | | | | Count only the runes up to the requested precision to decide where to truncate a string. Change the loop within truncate to need fewer jumps. name old time/op new time/op delta SprintfTruncateString-2 188ns ± 3% 155ns ± 3% -17.43% (p=0.000 n=20+20) Change-Id: I17ca9fc0bb8bf7648599df48e4785251bbc31e99 Reviewed-on: https://go-review.googlesource.com/20098 Reviewed-by: Rob Pike <r@golang.org>
* cmd/compile: introduce linestr helper to simplify line reportingRobert Griesemer2016-03-026-33/+37
| | | | | | | | Change-Id: Ic9ca792b55cc4ebd0ac6cfa2fbdb58030893bacd Reviewed-on: https://go-review.googlesource.com/20132 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime/pprof: sort counted profiles by countRuss Cox2016-03-022-12/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is especially helpful in programs with very large numbers of goroutines: the bulk of the goroutines will show up at the top. Before: 1 @ 0x86ab8 0x86893 0x82164 0x8e7ce 0x7b798 0x5b871 # 0x86ab8 runtime/pprof.writeRuntimeProfile+0xb8 /Users/rsc/go/src/runtime/pprof/pprof.go:545 # 0x86893 runtime/pprof.writeGoroutine+0x93 /Users/rsc/go/src/runtime/pprof/pprof.go:507 # 0x82164 runtime/pprof.(*Profile).WriteTo+0xd4 /Users/rsc/go/src/runtime/pprof/pprof.go:236 # 0x8e7ce runtime/pprof_test.TestGoroutineCounts+0x15e /Users/rsc/go/src/runtime/pprof/pprof_test.go:603 # 0x7b798 testing.tRunner+0x98 /Users/rsc/go/src/testing/testing.go:473 1 @ 0x2d373 0x2d434 0x560f 0x516b 0x7cd42 0x7b861 0x2297 0x2cf90 0x5b871 # 0x7cd42 testing.RunTests+0x8d2 /Users/rsc/go/src/testing/testing.go:583 # 0x7b861 testing.(*M).Run+0x81 /Users/rsc/go/src/testing/testing.go:515 # 0x2297 main.main+0x117 runtime/pprof/_test/_testmain.go:72 # 0x2cf90 runtime.main+0x2b0 /Users/rsc/go/src/runtime/proc.go:188 10 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e5b6 0x5b871 # 0x8e5b6 runtime/pprof_test.func1+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:582 50 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e656 0x5b871 # 0x8e656 runtime/pprof_test.func3+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:584 40 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e606 0x5b871 # 0x8e606 runtime/pprof_test.func2+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:583 After: 50 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ecc6 0x5b871 # 0x8ecc6 runtime/pprof_test.func3+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:584 40 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ec76 0x5b871 # 0x8ec76 runtime/pprof_test.func2+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:583 10 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ec26 0x5b871 # 0x8ec26 runtime/pprof_test.func1+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:582 1 @ 0x2d373 0x2d434 0x560f 0x516b 0x7cd42 0x7b861 0x2297 0x2cf90 0x5b871 # 0x7cd42 testing.RunTests+0x8d2 /Users/rsc/go/src/testing/testing.go:583 # 0x7b861 testing.(*M).Run+0x81 /Users/rsc/go/src/testing/testing.go:515 # 0x2297 main.main+0x117 runtime/pprof/_test/_testmain.go:72 # 0x2cf90 runtime.main+0x2b0 /Users/rsc/go/src/runtime/proc.go:188 1 @ 0x87128 0x86f03 0x82164 0x8ee30 0x7b798 0x5b871 # 0x87128 runtime/pprof.writeRuntimeProfile+0xb8 /Users/rsc/go/src/runtime/pprof/pprof.go:566 # 0x86f03 runtime/pprof.writeGoroutine+0x93 /Users/rsc/go/src/runtime/pprof/pprof.go:528 # 0x82164 runtime/pprof.(*Profile).WriteTo+0xd4 /Users/rsc/go/src/runtime/pprof/pprof.go:236 # 0x8ee30 runtime/pprof_test.TestGoroutineCounts+0x150 /Users/rsc/go/src/runtime/pprof/pprof_test.go:603 # 0x7b798 testing.tRunner+0x98 /Users/rsc/go/src/testing/testing.go:473 Change-Id: I43de9eee2d96f9c46f7b0fbe099a0571164324f5 Reviewed-on: https://go-review.googlesource.com/20107 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/compile: use int32 for line numbers consistentlyRobert Griesemer2016-03-0220-105/+87
| | | | | | | | | | - removed lots of unnecessary int(x) casts - removed parserline() - was inconsistently used anyway - minor simplifications in dcl.go Change-Id: Ibf7de679eea528a31c9692ef1c76a1d9b3239211 Reviewed-on: https://go-review.googlesource.com/20131 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* go/ast: fix typo in commentIan Lance Taylor2016-03-021-1/+1
| | | | | | | | Change-Id: I719231466286b3c0135314388a7c560ef44d7c35 Reviewed-on: https://go-review.googlesource.com/20130 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* crypto/tls: check errors from (*Conn).writeRecordTamir Duberstein2016-03-025-39/+123
| | | | | | | | | | | | | | This promotes a connection hang during TLS handshake to a proper error. This doesn't fully address #14539 because the error reported in that case is a write-on-socket-not-connected error, which implies that an earlier error during connection setup is not being checked, but it is an improvement over the current behaviour. Updates #14539. Change-Id: I0571a752d32d5303db48149ab448226868b19495 Reviewed-on: https://go-review.googlesource.com/19990 Reviewed-by: Adam Langley <agl@golang.org>
* cmd/link: C is gone, remove check for Go calling CDavid Crawshaw2016-03-024-63/+0
| | | | | | | | | | | | | It looks like the compiler still uses the Cfunc flag for functions marked as //go:systemstack, but if I'm reading this right, that doesn't apply here and the linker no longer needs Cfunc. Change-Id: I63b9192c2f52f41401263c29dc8dfd8be8a901a1 Reviewed-on: https://go-review.googlesource.com/20105 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* compress/bzip2: prevent zero-length Huffman codesJoe Tsai2016-03-022-3/+12
| | | | | | | | | | | | | | | | | | | | | | | Unlike RFC 1951 (DEFLATE), bzip2 does not use zero-length Huffman codes to indicate that the symbol is missing. Instead, bzip2 uses a sparse bitmap to indicate which symbols are present. Thus, it is undefined what happens when a length of zero is used. Thus, fix the parsing logic so that the length cannot ever go below 1-bit similar to how the C logic does things. To confirm that the C bzip2 utility chokes on this data: $ echo "425a6836314159265359b1f7404b000000400040002000217d184682ee48 a70a12163ee80960" | xxd -r -p | bzip2 -d bzip2: Data integrity error when decompressing For reference see: bzip2-1.0.6/decompress.c:320 Change-Id: Ic1568f8e7f80cdea51d887b4d712cc239c2fe85e Reviewed-on: https://go-review.googlesource.com/20119 Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net: fix vet warningsMohit Agarwal2016-03-023-8/+8
| | | | | | | | | | Updates #11041 Change-Id: I12c20beab75d7981efe470eb418e4b58dc8eb066 Reviewed-on: https://go-review.googlesource.com/20002 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: rename Hide to Hidden and make a boolDavid Crawshaw2016-03-025-18/+18
| | | | | | | | Change-Id: Ic99bd63c96b1eba5cc2b5cd2be3a575890a02996 Reviewed-on: https://go-review.googlesource.com/20103 Run-TryBot: David Crawshaw <crawshaw@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: write DWARF PC table without seekingDavid Crawshaw2016-03-021-86/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | This per-symbol table was written with the strategy: 1. record offset and write fake header 2. write body 3. seek back to fake header 4. write real header This CL collects the per-symbol body into a []byte, then writes the real header followed by the body to the output file. This saves two seeks per-symbol and overwriting the fake header. Small performance improvement (3.5%) in best-of-ten links of godoc: tip: real 0m1.132s user 0m1.256s this: real 0m1.090s user 0m1.210s I'm not sure if the performance measured here alone justifies it, but I think this is an easier to read style of code. Change-Id: I1663901eb7c2ee330591b8b6550cdff0402ed5dc Reviewed-on: https://go-review.googlesource.com/20074 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: add array append version of methodsDavid Crawshaw2016-03-028-1/+54
| | | | | | | | | | Used by DWARF writer changes in a followup CL. Change-Id: I6ec40dcfeaba909d9b8f6cf2603bc5b85c1fa873 Reviewed-on: https://go-review.googlesource.com/20073 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: some SSA cleanupKeith Randall2016-03-027-39/+21
| | | | | | | | | | | Do some easy TODOs. Move a bunch of other TODOs into bugs. Change-Id: Iaba9dad6221a2af11b3cbcc512875f4a85842873 Reviewed-on: https://go-review.googlesource.com/20114 Run-TryBot: Todd Neal <todd@tneal.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Todd Neal <todd@tneal.org>
* net/url: fix parsing of URLs ending in question markBrad Fitzpatrick2016-03-022-3/+14
| | | | | | | | | | | | | Fixes parsing regression from https://golang.org/cl/19931 which added the URL.ForceQuery field. Fixes #14573 Change-Id: I89575cab3f778b1bf78b2389623c866450b26943 Reviewed-on: https://go-review.googlesource.com/20116 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
* cmd/compile: give SymFlags type to Sym flagsRobert Griesemer2016-03-021-8/+10
| | | | | | | Change-Id: Ifa65a35418c2b5a2c517c0d9bbe37f472091e759 Reviewed-on: https://go-review.googlesource.com/20115 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/vet: polish output of shadow testMarvin Stenger2016-03-023-9/+9
| | | | | | | | | | | | | | | | | This commit modifies the style of a error message in case of -shadow. Previously such a message would look like: foo.go:42: declaration of err shadows declaration at shadow.go:13: Changes of the commit include highlighting the variable name and removing the ": "(space intended) at the end of the line: foo.go:42: declaration of "err" shadows declaration at shadow.go:13 Fixes #14585. Change-Id: Ia6a6bf396668dcba9a24f025a08d8826db31f434 Reviewed-on: https://go-review.googlesource.com/20093 Reviewed-by: Rob Pike <r@golang.org>
* all: single space after period.Brad Fitzpatrick2016-03-02536-1732/+1732
| | | | | | | | | | | | | | | | | | | | The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: fix OADDSTR buffer size calculationIan Lance Taylor2016-03-021-2/+2
| | | | | | | | | | | | | | | | | | | The size calculation has been wrong since this code was first committed in https://golang.org/cl/3120. The effect was that the compiler always allocated a temporary buffer on the stack for a non-escaping string concatenation. This turns out to make no practical difference, as the compiler always allocates a buffer of the same size (32 bytes) and the runtime only uses the temporary buffer if the concatenated strings fit (check is in rawstringtmp in runtime/string.go). The effect of this change is to avoid generating a temporary buffer on the stack that will not be used. Change-Id: Id632bfe3d6c113c9934c018a2dd4bcbf1784a63d Reviewed-on: https://go-review.googlesource.com/20112 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: s/flag_race/instrumenting/ in OCONVNOP checkIan Lance Taylor2016-03-011-1/+1
| | | | | | | | | | | | | This check seems to apply to all code instrumentation, not just -race. Fixes #14589. Change-Id: I16ae07749ede7c1e6ed06f472711638d195034ac Reviewed-on: https://go-review.googlesource.com/20113 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-01787-788/+788
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: delete unused lexer tokens, replace with LOPERRobert Griesemer2016-03-012-67/+49
| | | | | | | | | | Also: Use same ordering of tokens in the various tables/maps. Change-Id: Ief84c6ca3da36213ace6b2c10b513e2ca16318ab Reviewed-on: https://go-review.googlesource.com/20110 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/compile: remove _ssa print triggerKeith Randall2016-03-011-1/+1
| | | | | | | | | | SSA is a real compiler now, don't trigger on function names. Change-Id: Iaf6dd78248c1b6ca2630275bd59f7ea7b7576497 Reviewed-on: https://go-review.googlesource.com/20088 Reviewed-by: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* Merge "Merge branch 'dev.ssa' into mergebranch"Gerrit Code Review2016-03-01148-207/+69628
|\
| * Merge branch 'dev.ssa' into mergebranchKeith Randall2016-03-01148-207/+69628
| |\ | | | | | | | | | | | | | | | Merge dev.ssa branch back into master. Change-Id: Ie6fac3f8d355ab164f934415fe4fc7fcb8c3db16
| | * [dev.ssa] cmd/compile: adjust branch likeliness for calls/loopsDavid Chase2016-03-014-3/+388
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Static branch predictions (which guide block ordering) are adjusted based on: loop/not-loop (favor looping) abnormal-exit/not (avoid panic) call/not-call (avoid call) ret/default (treat returns as rare) This appears to make no difference in performance of real code, meaning the compiler itself. The earlier version of this has been stripped down to help make the cost of this only-aesthetic-on-Intel phase be as cheap as possible (we probably want information about inner loops for improving register allocation, but because register allocation follows close behind this pass, conceivably the information could be reused -- so we might do this anyway just to normalize output). For a ./make.bash that takes 200 user seconds, about .75 second is reported in likelyadjust (summing nanoseconds reported with -d=ssa/likelyadjust/time ). Upstream predictions are respected. Includes test, limited to build on amd64 only. Did several iterations on the debugging output to allow some rough checks on behavior. Debug=1 logging notes agree/disagree with earlier passes, allowing analysis like the following: Run on make.bash: GO_GCFLAGS=-d=ssa/likelyadjust/debug \ ./make.bash >& lkly5.log grep 'ranch prediction' lkly5.log | wc -l 78242 // 78k predictions grep 'ranch predi' lkly5.log | egrep -v 'agrees with' | wc -l 29633 // 29k NEW predictions grep 'disagrees' lkly5.log | wc -l 444 // contradicted 444 times grep '< exit' lkly5.log | wc -l 10212 // 10k exit predictions grep '< exit' lkly5.log | egrep 'disagrees' | wc -l 5 // 5 contradicted by previous prediction grep '< exit' lkly5.log | egrep -v 'agrees' | wc -l 702 // 702-5 redundant with previous prediction grep '< call' lkly5.log | egrep -v 'agrees' | wc -l 16699 // 16k new call predictions grep 'stay in loop' lkly5.log | egrep -v 'agrees' | wc -l 3951 // 4k new "remain in loop" predictions Fixes #11451. Change-Id: Iafb0504f7030d304ef4b6dc1aba9a5789151a593 Reviewed-on: https://go-review.googlesource.com/19995 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
| | * cmd/compile/internal/ssa: cleanup godocsMatthew Dempsky2016-03-015-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a blank line before the "package ssa" lines so the "autogenerated don't edit" comments don't end up in godoc output. Change-Id: I82bf90d52d426ce1a8e21483fc8f47b3689259c7 Reviewed-on: https://go-review.googlesource.com/20086 Reviewed-by: Keith Randall <khr@golang.org>
| | * [dev.ssa] cmd/compile/internal/ssa: simplify boolean phisAlexandru Moșoi2016-03-013-0/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Decreases the generated code slightly. * Similar to phiopt pass from gcc, except it only handles booleans. Handling Eq/Neq had no impact on the generated code. name old time/op new time/op delta Template 453ms ± 4% 451ms ± 4% ~ (p=0.468 n=24+24) GoTypes 1.55s ± 1% 1.55s ± 2% ~ (p=0.287 n=24+25) Compiler 6.53s ± 2% 6.56s ± 1% +0.46% (p=0.050 n=23+23) MakeBash 45.8s ± 2% 45.7s ± 2% ~ (p=0.866 n=24+25) name old text-bytes new text-bytes delta HelloSize 676k ± 0% 676k ± 0% ~ (all samples are equal) CmdGoSize 8.07M ± 0% 8.07M ± 0% -0.03% (p=0.000 n=25+25) Change-Id: Ia62477b7554127958a14cb27f85849b095d63663 Reviewed-on: https://go-review.googlesource.com/20090 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro> TryBot-Result: Gobot Gobot <gobot@golang.org>
| | * [dev.ssa] cmd/compile/internal/ssa: distribute multiplication into additionAlexandru Moșoi2016-03-012-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * This is a very basic form of straight line strength reduction. * Removes one multiplication from a[b].c++; a[b+1].c++ * It increases pressure on the register allocator because CSE creates more copies of the multiplication sizeof(a[0])*b. Change-Id: I686a18e9c24cc6f8bdfa925713afed034f7d36d0 Reviewed-on: https://go-review.googlesource.com/20091 Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
| | * [dev.ssa] cmd/compile: promote byte/word operationIlya Tocar2016-03-013-97/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing to low 8/16 bits of register creates false dependency Generate 32-bit operations when possible. Change-Id: I8eb6c1c43a66424eec6baa91a660bceb6b80d1d3 Reviewed-on: https://go-review.googlesource.com/19506 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
| | * [dev.ssa] cmd/compile: Make PPARAMOUT variables SSAableKeith Randall2016-03-013-22/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add writeback code to each return location which copies the final result back to the correct stack location. Cgo plays tricky games by taking the address of a in f(a int) (b int) and then using that address to modify b. So for cgo-generated Go code, disable the SSAing of output args. Update #14511 Change-Id: I95cba727d53699d31124eef41db0e03935862be9 Reviewed-on: https://go-review.googlesource.com/19988 Reviewed-by: Todd Neal <todd@tneal.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>