- 16 Aug, 2016 40 commits
-
-
Josh Bleecher Snyder authored
This CL teaches SSA to recognize code of the form // b is a boolean value, i is an int of some flavor if b { i = 1 } else { i = 0 } and use b's underlying 0/1 representation for i instead of generating jumps. Unfortunately, it does not work on the obvious code: func bool2int(b bool) int { if b { return 1 } return 0 } This is left for future work. Note that the existing phiopt optimizations also don't work for: func neg(b bool) bool { if b { return false } return true } In the meantime, runtime authors and the like can use: func bool2int(b bool) int { var i int if b { i = 1 } else { i = 0 } return i } This compiles to: "".bool2int t=1 size=16 args=0x10 locals=0x0 0x0000 00000 (x.go:25) TEXT "".bool2int(SB), $0-16 0x0000 00000 (x.go:25) FUNCDATA $0, gclocals·23e8278e2b69a3a75fa59b23c49ed6ad(SB) 0x0000 00000 (x.go:25) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x0000 00000 (x.go:32) MOVBLZX "".b+8(FP), AX 0x0005 00005 (x.go:32) MOVBQZX AL, AX 0x0008 00008 (x.go:32) MOVQ AX, "".~r1+16(FP) 0x000d 00013 (x.go:32) RET The extraneous MOVBQZX is #15300. This optimization also helps range and slice. The compiler must protect against pointers pointing to the end of a slice/string. It does this by increasing a pointer by either 0 or 1 * elemsize, based on a condition. This CL optimizes away a jump in that code. This CL triggers 382 times while compiling the standard library. Updating code to utilize this optimization is left for future CLs. Updates #6011 Change-Id: Ia7c1185f8aa223c543f91a3cd6d4a2a09c691c70 Reviewed-on: https://go-review.googlesource.com/22711 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Robert Griesemer authored
For #16369. Change-Id: I4c9f5a66b95558adcc1bcface164b9b2b4382d2f Reviewed-on: https://go-review.googlesource.com/24979Reviewed-by: Alan Donovan <adonovan@google.com>
-
David Crawshaw authored
Fixes #16722 Change-Id: I50a0e69d3e79d13bc1860cd983267c3db087a4b8 Reviewed-on: https://go-review.googlesource.com/27119Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Keith Randall authored
Don't fold constant factors into a multiply beyond the capacity of a MULQ instruction (32 bits). Fixes #16733 Change-Id: Idc213c6cb06f7c94008a8cf9e60a9e77d085fd89 Reviewed-on: https://go-review.googlesource.com/27160 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
We already inlined _, ok = e.(T) _, ok = i.(E) _, ok = e.(E) The only ok-only variants not inlined are now _, ok = i.(I) _, ok = e.(I) These call getitab, so are non-trivial. Change-Id: Ie45fd8933ee179a679b92ce925079b94cff0ee12 Reviewed-on: https://go-review.googlesource.com/26658 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Michael Pratt authored
Now that assembler opcodes have their own type, they can have a true stringer, rather than explicit calls to Aconv, which makes for nicer format strings. Change-Id: Ic77f5f8ac38b4e519dcaa08c93e7b732226f7bfe Reviewed-on: https://go-review.googlesource.com/25045 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Josh Bleecher Snyder authored
Pick up a bunch of changes and fixes. Change-Id: If4101f7185d433a4c89096bc786ee5de8eeabac0 Reviewed-on: https://go-review.googlesource.com/27123 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
No functional changes, makes vet happy. Updates #11041 Change-Id: I59f3aba46d19b86d605508978652d76a1fe7ac7b Reviewed-on: https://go-review.googlesource.com/27125 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
Makes vet happy. Updates #11041 Change-Id: I23ca413c03ff387359440af8114786cd7880a048 Reviewed-on: https://go-review.googlesource.com/27124 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
Fixes (legit) vet warnings. Fix some verb tenses while we're here. Updates #11041 Change-Id: I27e995f55b38f4cf584e97a67b8545e8247e83d6 Reviewed-on: https://go-review.googlesource.com/27122 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Josh Bleecher Snyder authored
Give *recordingConn the correct WriteTo signature to be an io.WriterTo. This makes vet happy. It also means that it'll report errors, which were previously being ignored. Updates #11041 Change-Id: I13f171407d63f4b62427679bff362eb74faddca5 Reviewed-on: https://go-review.googlesource.com/27121 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
Caught by vet. Updates #11041 Change-Id: I4dbb2eeaf633eea5976074840064edc2349e01d8 Reviewed-on: https://go-review.googlesource.com/27120 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Josh Bleecher Snyder authored
container/list/list_test.go:274: self-assignment of e1 to e1 container/list/list_test.go:274: self-assignment of e4 to e4 container/list/list_test.go:282: self-assignment of e1 to e1 container/list/list_test.go:286: self-assignment of e1 to e1 container/list/list_test.go:286: self-assignment of e4 to e4 Updates #11041 Change-Id: Ibd90cf6a924e93497908f437b814c3fc82937f4a Reviewed-on: https://go-review.googlesource.com/27114 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Cherry Zhang authored
CL 23393 introduces PAUTOHEAP, and access of PAUTOHEAP variable is rewritten to indirection of a PAUTO variable. Mark this variable non-nil, so this indirection does not introduce extra nil checks. Change-Id: I31853eed5e60238b6c5bc0546e2e9ab340dcddd9 Reviewed-on: https://go-review.googlesource.com/26831 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
For tests, assign to _. For benchmarks, assign to a sink. Updates #11041 Change-Id: I87c5543245c7bc74dceb38902f4551768dd37948 Reviewed-on: https://go-review.googlesource.com/27116 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
We were generating format strings containing a lone %. Vet legitimately complains: cmd/compile/internal/gc/constFold_test.go:339: unrecognized printf verb ' ' The fix doesn't make for very readable code, but it is simple and obviously correct. Updates #11041 Change-Id: I90bd2d1d140887f5229752a279f7e46921472fbb Reviewed-on: https://go-review.googlesource.com/27115 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
Updates #11041 Change-Id: I77e5ca0b61ffc530ee46848721a177867c81d548 Reviewed-on: https://go-review.googlesource.com/25116 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
This is preliminary work to unifying them. Aside from Syscall9, all are identical. Syscall9 has a netbsd/openbsd variant and a dragonfly/freebsd variant. Updates #11041 Change-Id: Ia5ce95d5e9115d4c0492d5e53aa7a4316deafd1f Reviewed-on: https://go-review.googlesource.com/25115 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
This is preliminary work to unifying them. Updates #11041 Change-Id: Ibe83da3d626f1da9e8888e26cedd3af2152b42e6 Reviewed-on: https://go-review.googlesource.com/25114 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
This is preliminary work to unifying the unix amd64 assembly implementations, which is preliminary work to making the assembly vet-friendly. Updates #11041 Change-Id: Ic64985124f8fb86cc08898be2ec7fca972ced4ca Reviewed-on: https://go-review.googlesource.com/25113 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
They were identical. This will allow us to do the TODO at the top of the file only once. Updates #11041 Change-Id: I07aaca27ae46b66b65780082988bdc7546ed534b Reviewed-on: https://go-review.googlesource.com/25112 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Cherry Zhang authored
Darwin linker does not support BR26 reloc with non-zero addend. Fixes #16724. Change-Id: I1b5b4dc7159141bde3e273490f435c08c583afaf Reviewed-on: https://go-review.googlesource.com/27081 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
-
Brad Fitzpatrick authored
If the server failed on us before we even tried to write any bytes, it's safe to retry the request on a new connection, regardless of the HTTP method/idempotence. Fixes #15723 Change-Id: I25360f82aac530d12d2b3eef02c43ced86e62906 Reviewed-on: https://go-review.googlesource.com/27117Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
Follow-up to CL 26661 Change-Id: I67c58d17313094675cf0f30ce50d486818ae0dcb Reviewed-on: https://go-review.googlesource.com/27113 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Gyu-Ho Lee authored
Preallocate keys slice with the length of paxHeaders map to prevent slice growth with append operations. Change-Id: Ic9a927c4eaa775690a4ef912d61dd06f38e11510 Reviewed-on: https://go-review.googlesource.com/23782Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Mikio Hara authored
Change-Id: Iedf9000e3bb1fa73b4c3669eae846e85f1f5fdfe Reviewed-on: https://go-review.googlesource.com/24489 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Brad Fitzpatrick authored
Let the kernel pick a port for testing, and have the server in the child process tell the parent (benchmarking) process the port that was selected. Fixes flakes like seen in https://golang.org/cl/27050 (and previously) Change-Id: Ia2b705dc4152f70e0a5725015bdae09984d09d53 Reviewed-on: https://go-review.googlesource.com/27051 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Jan Mercl authored
Methods of FileSet are documented to be safe for concurrent use by multiple goroutines, so FileSet is protected by a mutex and all its methods use it to prevent concurrent mutations. All methods of File that mutate the respective FileSet, including AddLine, do also lock its mutex, but that does not help when PositionFor is invoked concurrently and reads without synchronization what AddLine mutates. The change adds acquiring a RLock around the racy call of File.position and the respective test. Fixes #16548 Change-Id: Iecaaa02630b2532cb29ab555376633ee862315dd Reviewed-on: https://go-review.googlesource.com/25345Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Carlos C authored
`bytes` and `strings` are pretty similar to each other, this commit brings `strings` examples to its counter-part. Partially addresses #16360 Change-Id: I551320eaa78be9df69012035f1c3333f500e04c9 Reviewed-on: https://go-review.googlesource.com/25062Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Chris Broadfoot authored
Change-Id: Ib17f6643efd49e2bca188c4faa505f79832d18b1 Reviewed-on: https://go-review.googlesource.com/27110Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Mikio Hara authored
Change-Id: I8085ed43d63215237a4871cc1e44257132a7f5de Reviewed-on: https://go-review.googlesource.com/27130Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Sina Siadat authored
The heap.Fix function calls both down and up. If the element is moved down, we don't need to call up and we could save a comparison. (per suggestion by Radu Berinde) Fixes #16098. Change-Id: I83a74710e66cf0d274d8c0743338c26f89f31afe Reviewed-on: https://go-review.googlesource.com/24273Reviewed-by: Robert Griesemer <gri@golang.org>
-
Michael Hudson-Doyle authored
When dynamically linking, a type symbol's name is replaced with a name based on the SHA1 of the name as type symbol's names can be very long. However, this can make a type's symbol name longer in some cases. So skip it in that case. One of the symbols this changes the treatment of is 'type.string' and that fixes a bug where -X doesn't work when dynamically linking. Fixes #16671 Change-Id: If5269038261b76fb0ec52e25a9c1d64129631e3c Reviewed-on: https://go-review.googlesource.com/26890 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Brad Fitzpatrick authored
We already had special cases for 0 and 1. Add 2 and 3 for now too. To be removed if the compiler is improved later (#6714). This halves the number of allocations and total bytes allocated via common filepath.Join calls, improving filepath.Walk performance. Noticed as part of investigating filepath.Walk in #16399. Change-Id: If7b1bb85606d4720f3ebdf8de7b1e12ad165079d Reviewed-on: https://go-review.googlesource.com/25005Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
Generated with: stringer -type AddrType cmd/internal/obj Change-Id: I74509cffab774035c5ca2ac0634638d73dbd33f3 Reviewed-on: https://go-review.googlesource.com/26657 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
This still depends on Curfn, but it's progress. Updates #15756 Change-Id: Ic32fe56f44fcfbc023e7668d4dee07f8b47bf3a4 Reviewed-on: https://go-review.googlesource.com/26661 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Josh Bleecher Snyder authored
This fixes the following vet warnings: go/types/builtins.go:437: arg call for printf verb %s of wrong type: *go/ast.CallExpr go/types/builtins.go:598: arg call for printf verb %s of wrong type: *go/ast.CallExpr Updates #11041 Change-Id: I746d054e8e49b330fbdf961912a98f55dd5f3ff9 Reviewed-on: https://go-review.googlesource.com/26997 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Josh Bleecher Snyder authored
Fixes #16464 Change-Id: Ibf5625c1b5fa3abd18623023f18664e8f81fa45a Reviewed-on: https://go-review.googlesource.com/26996 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Carlos C authored
Fixes #16648 Change-Id: I3ab21ab33ca3f41219de9518ac6a39f49131e5e5 Reviewed-on: https://go-review.googlesource.com/26692Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Josh Bleecher Snyder authored
This allows the compiler to remove a bounds check. math/big/nat.go:681: index bounds check elided math/big/nat.go:683: index bounds check elided Change-Id: Ieecb89ec5e988761b06764bd671672015cd58e9d Reviewed-on: https://go-review.googlesource.com/26663 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-