- 20 Apr, 2015 10 commits
-
-
Russ Cox authored
This is primarily about making the code clearer, but as part of the cleanup componentgen is now much more consistent about what it does and does not attempt. The new limit is to 8 move instructions. The old limit was either 3 or 4 small things but in the details it was quite inconsistent: ints, interfaces, strings, and slices all counted as small; it handled a struct containing two ints, but not a struct containing a struct containing two ints; it handled slices and interfaces and a struct containing a slice but not a struct containing an interface; and so on. The new code runs at about the same speed as the old code if limited to 4 moves, but that's much more restrictive when the pieces are strings or interfaces. With the limit raised to 8 moves, this CL is sometimes a significant improvement: benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 4361174290 4362870005 +0.04% BenchmarkFannkuch11 3008201483 2974408533 -1.12% BenchmarkFmtFprintfEmpty 79.0 79.5 +0.63% BenchmarkFmtFprintfString 281 261 -7.12% BenchmarkFmtFprintfInt 264 262 -0.76% BenchmarkFmtFprintfIntInt 447 443 -0.89% BenchmarkFmtFprintfPrefixedInt 354 361 +1.98% BenchmarkFmtFprintfFloat 500 452 -9.60% BenchmarkFmtManyArgs 1688 1693 +0.30% BenchmarkGobDecode 11718456 11741179 +0.19% BenchmarkGobEncode 10144620 10161627 +0.17% BenchmarkGzip 437631642 435271877 -0.54% BenchmarkGunzip 109468858 110173606 +0.64% BenchmarkHTTPClientServer 76248 75362 -1.16% BenchmarkJSONEncode 24160474 23753091 -1.69% BenchmarkJSONDecode 84470041 82902026 -1.86% BenchmarkMandelbrot200 4676857 4687040 +0.22% BenchmarkGoParse 4954602 4923965 -0.62% BenchmarkRegexpMatchEasy0_32 151 151 +0.00% BenchmarkRegexpMatchEasy0_1K 450 452 +0.44% BenchmarkRegexpMatchEasy1_32 131 130 -0.76% BenchmarkRegexpMatchEasy1_1K 713 695 -2.52% BenchmarkRegexpMatchMedium_32 227 218 -3.96% BenchmarkRegexpMatchMedium_1K 63911 62966 -1.48% BenchmarkRegexpMatchHard_32 3163 3026 -4.33% BenchmarkRegexpMatchHard_1K 93985 90266 -3.96% BenchmarkRevcomp 650697093 649211600 -0.23% BenchmarkTemplate 107049170 106804076 -0.23% BenchmarkTimeParse 448 452 +0.89% BenchmarkTimeFormat 468 460 -1.71% Change-Id: I08563133883e88bb9db9e9e4dee438a5af2787da Reviewed-on: https://go-review.googlesource.com/9004Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Russ Cox authored
This CL revises CL 7504 to use explicitly uintptr types for the struct fields that are going to be updated sometimes without write barriers. The result is that the fields are now updated *always* without write barriers. This approach has two important properties: 1) Now the GC never looks at the field, so if the missing reference could cause a problem, it will do so all the time, not just when the write barrier is missed at just the right moment. 2) Now a write barrier never happens for the field, avoiding the (correct) detection of inconsistent write barriers when GODEBUG=wbshadow=1. Change-Id: Iebd3962c727c0046495cc08914a8dc0808460e0e Reviewed-on: https://go-review.googlesource.com/9019Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Matthew Dempsky authored
The majority of this CL was prepared via scripted invocations of `gofmt -w -r "$SYM -> obj.$SYM" cmd/internal/ld/*.go` and `gofmt -w -r "ld.$SYM -> obj.$SYM" cmd/?l/*.go`. Because of issue #7417, that was followed by repeatedly running an AWK script to identify lines that differed other than whitespace changes or "ld." or "obj." prefixes and manually restoring comments. Finally, the redundant constants from cmd/internal/ld/link.go were removed, and "goimports -w" was used to cleanup import lines. Passes rsc.io/toolstash/buildall, even when modified to also build cmd. Fixes #10055. Change-Id: Icd5dbe819a3b6520ce883748e60017dc8e9a2e85 Reviewed-on: https://go-review.googlesource.com/9112Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Russ Cox authored
The go command prints paths in errors relative to its current directory. Since all.bash and run.bash are run in $GOROOT/src, prefer to run the go command, so that the relative paths are correct. Before this CL, running all.bash in $GOROOT/src: ##### Testing race detector # net/http src/net/http/transport.go:1257: cannot take the address of <node EFACE> This is wrong (or at least less useful) because there is no $GOROOT/src/src/net/http directory. Change-Id: I0c0d52c22830d79b3715f51a6329a3d33de52a72 Reviewed-on: https://go-review.googlesource.com/9157Reviewed-by: Rob Pike <r@golang.org>
-
Ian Lance Taylor authored
The callee-saved registers must be saved because for the c-shared case this code is invoked from C code in the system library, and that code expects the registers to be saved. The tests were passing because in the normal case the code calls a cgo function that naturally saves callee-saved registers anyhow. However, it fails when the code takes the non-cgo path. Change-Id: I9c1f5e884f5a72db9614478049b1863641c8b2b9 Reviewed-on: https://go-review.googlesource.com/9114Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Ian Lance Taylor authored
Change-Id: I4ee6dac32bd3759aabdfdc92b235282785fbcca9 Reviewed-on: https://go-review.googlesource.com/9083Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Brad Fitzpatrick authored
Change-Id: I5964fc55157dc1df7be400dfa0df591d6163e25e Reviewed-on: https://go-review.googlesource.com/9084Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
-
David Crawshaw authored
Turns out all the necessary pieces have already been submitted. Change-Id: I19c8d614cd756821ce400ca7a338029002780b18 Reviewed-on: https://go-review.googlesource.com/9076Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
-
David Crawshaw authored
Change-Id: I0d3f9841500e0a41f1c427244869bf3736a31e18 Reviewed-on: https://go-review.googlesource.com/9075Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
-
Hyang-Ah Hana Kim authored
Change-Id: Ia2c0c617df523482ba1a25b7492267eb80f0819a Reviewed-on: https://go-review.googlesource.com/9033 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
- 19 Apr, 2015 2 commits
-
-
Michael Hudson-Doyle authored
In https://golang.org/cl/7797 I attempted to use myimportpath to set the value of the go.importpath.$foo. symbol for the module being compiled, but I messed it up and only set the name (which the linker rewrites anyway). This lead to the importpath for the module being compiled being "". This was hard to notice, because all modules that import another define the importpath for their imported modules correctly -- but main is not imported, and this meant that the reflect module saw all fields of all types defined in the main module as exported. The fix is to do what I meant to do the first time, add a test and change the go tool to compile main packages with -p main and not -p command-line-arguments. Fixes #10332 Change-Id: I5fc6e9b1dc2b26f058641e382f9a56a526eca291 Reviewed-on: https://go-review.googlesource.com/8481Reviewed-by: Russ Cox <rsc@golang.org>
-
Mikio Hara authored
Change-Id: Ic965b48bdc0e0ffba9bed5ff6b3d28ff742f8b2d Reviewed-on: https://go-review.googlesource.com/9100Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
- 18 Apr, 2015 9 commits
-
-
Matthew Dempsky authored
This avoids a race condition with go1.go wanting to examine files in the current directory with filepath.Walk(".", walkFn). Fixes #10497. Change-Id: I2159f40a08d1a768195dbb7ea3c27e38cf9740bb Reviewed-on: https://go-review.googlesource.com/9110Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Mikio Hara authored
This change fixes inconsistent error values on Accept{,TCP,Unix}. Updates #4856. Change-Id: Ie3bb534c19a724cacb3ea3f3656e46c810b2123f Reviewed-on: https://go-review.googlesource.com/8996Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This change fixes inconsistent error values on Close, CloseRead and CloseWrite. Updates #4856. Change-Id: I3c4d46ccd7d6e1a2f52d8e75b512f62c533a368d Reviewed-on: https://go-review.googlesource.com/8994Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This change fixes inconsistent error values on Write, WriteTo{,UDP,IP,Unix} and WriteMsg{UDP,IP,Unix}. Updates #4856. Change-Id: I4208ab6a0650455ad7d70a80a2d6169351d6055f Reviewed-on: https://go-review.googlesource.com/8993Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Mikio Hara authored
This change fixes inconsistent error values on Read, ReadFrom{,UDP,IP,Unix} and ReadMsg{UDP,IP,Unix}. Updates #4856. Change-Id: I7de5663094e09be2d78cdb18ce6f1e7ec260888d Reviewed-on: https://go-review.googlesource.com/8992Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Josh Bleecher Snyder authored
Change-Id: Ied0eab872950793b34dd2268055b29c702b07e99 Reviewed-on: https://go-review.googlesource.com/9081Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
-
Mikio Hara authored
Change-Id: I7c6c91a0551aacb49e1beb4a39215b93c8c7fcfa Reviewed-on: https://go-review.googlesource.com/8997Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Matthew Dempsky authored
Fixes #10453. Change-Id: I77470279865d4c954df615d6594c69edf68c28ca Reviewed-on: https://go-review.googlesource.com/9090Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Brad Fitzpatrick authored
Clear out gg.go files, and move things into consistent places between the cmd/?g directories. Change-Id: I81e04180613b806e0bfbb88519e66111ce9f74a3 Reviewed-on: https://go-review.googlesource.com/9080Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
- 17 Apr, 2015 19 commits
-
-
Mikio Hara authored
This change adds a type addrinfoErrno to represent getaddrinfo, getnameinfo-specific errors, and uses it in cgo-based lookup functions. Also retags cgo files for clarification and does minor cleanup. Change-Id: I6db7130ad7bf35bbd4e8839a97759e1364c43828 Reviewed-on: https://go-review.googlesource.com/9020Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
David Crawshaw authored
I have left the Diag calls in place where I believe Ctxt.Cursym != nil which means this CL is not the improvement I had hoped for. However it is now safe to call Exitf whereever you are in the linker, which makes it easier to reason about some code. Change-Id: I8261e761ca9719f7d216e2747314adfe464e3337 Reviewed-on: https://go-review.googlesource.com/8668Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
David Crawshaw authored
Change-Id: I4278abca9d2a8f25149fa8935a93d32e7d04a43a Reviewed-on: https://go-review.googlesource.com/9050Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Matthew Dempsky authored
Change-Id: I4e59b5b1702e08d7c6191d0a70fb0a555f3340c8 Reviewed-on: https://go-review.googlesource.com/9061 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Rob Pike <r@golang.org>
-
Rob Pike authored
Change-Id: I9968ce162996e71843eeaf9764d216c401427fed Reviewed-on: https://go-review.googlesource.com/9040Reviewed-by: Rob Pike <r@golang.org>
-
Rob Pike authored
Fix some out-of-date remarks. Fixes #10489. Change-Id: I8f0cce2588828052a5d013e7bac6bcfeb220579d Reviewed-on: https://go-review.googlesource.com/9008Reviewed-by: Russ Cox <rsc@golang.org>
-
Rob Pike authored
Also use os.Expand for variable substitution so ${x}y works. Fixes #9960. Change-Id: Ic8239b2e737d1f41910dde8ee9524ac48907cb03 Reviewed-on: https://go-review.googlesource.com/9007Reviewed-by: Russ Cox <rsc@golang.org>
-
Josh Bleecher Snyder authored
Use SETcc instructions instead of Jcc to generate boolean values. This generates shorter, jump-free code, which may in turn enable other peephole optimizations. For example, given func f(i, j int) bool { return i == j } Before "".f t=1 size=32 value=0 args=0x18 locals=0x0 0x0000 00000 (x.go:3) TEXT "".f(SB), $0-24 0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·b4c25e9b09fd0cf9bb429dcefe91c353(SB) 0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x0000 00000 (x.go:4) MOVQ "".i+8(FP), BX 0x0005 00005 (x.go:4) MOVQ "".j+16(FP), BP 0x000a 00010 (x.go:4) CMPQ BX, BP 0x000d 00013 (x.go:4) JEQ 21 0x000f 00015 (x.go:4) MOVB $0, "".~r2+24(FP) 0x0014 00020 (x.go:4) RET 0x0015 00021 (x.go:4) MOVB $1, "".~r2+24(FP) 0x001a 00026 (x.go:4) JMP 20 After "".f t=1 size=32 value=0 args=0x18 locals=0x0 0x0000 00000 (x.go:3) TEXT "".f(SB), $0-24 0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·b4c25e9b09fd0cf9bb429dcefe91c353(SB) 0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x0000 00000 (x.go:4) MOVQ "".i+8(FP), BX 0x0005 00005 (x.go:4) MOVQ "".j+16(FP), BP 0x000a 00010 (x.go:4) CMPQ BX, BP 0x000d 00013 (x.go:4) SETEQ "".~r2+24(FP) 0x0012 00018 (x.go:4) RET regexp benchmarks, best of 12 runs: benchmark old ns/op new ns/op delta BenchmarkNotOnePassShortB 782 733 -6.27% BenchmarkLiteral 180 171 -5.00% BenchmarkNotLiteral 2855 2721 -4.69% BenchmarkMatchHard_32 2672 2557 -4.30% BenchmarkMatchHard_1K 80182 76732 -4.30% BenchmarkMatchEasy1_32M 76440180 73304748 -4.10% BenchmarkMatchEasy1_32K 68798 66350 -3.56% BenchmarkAnchoredLongMatch 482 465 -3.53% BenchmarkMatchEasy1_1M 2373042 2292692 -3.39% BenchmarkReplaceAll 2776 2690 -3.10% BenchmarkNotOnePassShortA 1397 1360 -2.65% BenchmarkMatchClass_InRange 3842 3742 -2.60% BenchmarkMatchEasy0_32 125 122 -2.40% BenchmarkMatchEasy0_32K 11414 11164 -2.19% BenchmarkMatchEasy0_1K 668 654 -2.10% BenchmarkAnchoredShortMatch 260 255 -1.92% BenchmarkAnchoredLiteralShortNonMatch 164 161 -1.83% BenchmarkOnePassShortB 623 612 -1.77% BenchmarkOnePassShortA 801 788 -1.62% BenchmarkMatchClass 4094 4033 -1.49% BenchmarkMatchEasy0_32M 14078800 13890704 -1.34% BenchmarkMatchHard_32K 4095844 4045820 -1.22% BenchmarkMatchEasy1_1K 1663 1643 -1.20% BenchmarkMatchHard_1M 131261708 129708215 -1.18% BenchmarkMatchHard_32M 4210112412 4169292003 -0.97% BenchmarkMatchMedium_32K 2460752 2438611 -0.90% BenchmarkMatchEasy0_1M 422914 419672 -0.77% BenchmarkMatchMedium_1M 78581121 78040160 -0.69% BenchmarkMatchMedium_32M 2515287278 2498464906 -0.67% BenchmarkMatchMedium_32 1754 1746 -0.46% BenchmarkMatchMedium_1K 52105 52106 +0.00% BenchmarkAnchoredLiteralLongNonMatch 185 185 +0.00% BenchmarkMatchEasy1_32 107 107 +0.00% BenchmarkOnePassLongNotPrefix 505 505 +0.00% BenchmarkOnePassLongPrefix 147 147 +0.00% The godoc binary is ~0.12% smaller after this CL. Updates #5729. toolstash -cmp passes for all architectures other than amd64 and amd64p32. Other architectures can be done in follow-up CLs. Change-Id: I0e167e259274b722958567fc0af83a17ca002da7 Reviewed-on: https://go-review.googlesource.com/2284Reviewed-by: Russ Cox <rsc@golang.org>
-
Ian Lance Taylor authored
Change-Id: I87147ca6bb53e3121cc4245449c519509f107638 Reviewed-on: https://go-review.googlesource.com/9009 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Russ Cox authored
$ sam -d cmd/internal/gc/*.{go,y} cmd/?g/*.go X ,s/, (gc\.)?[BFHNST]conv\(([^()]+), 0\)/, \2/g X/'/w q $ Change-Id: Ic28a4807d237b8ae53ceca1e4e7fdb43580ab560 Reviewed-on: https://go-review.googlesource.com/9032Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com>
-
Russ Cox authored
The next CL will remove unnecessary conv calls. Change-Id: I0e8dbd1756cdec1ef6095ae67629cd3fae0fb4a4 Reviewed-on: https://go-review.googlesource.com/9031Reviewed-by: Austin Clements <austin@google.com>
-
Russ Cox authored
It's not helping anymore, and it's fooling people who try to understand performance (like me). Change-Id: I133a644acae0ddf1bfa17c654cdc01e2089da963 Reviewed-on: https://go-review.googlesource.com/9018Reviewed-by: Austin Clements <austin@google.com>
-
Ian Lance Taylor authored
Change-Id: I8c97751a79b57197428b0f0b66fc9575708a2eb0 Reviewed-on: https://go-review.googlesource.com/8979 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
-
Austin Clements authored
readyExecute passes a closure to mcall that captures an argument to readyExecute. Since mcall is marked noescape, this closure lives on the stack of the calling goroutine. However, the closure puts the calling goroutine on the run queue (and switches to a new goroutine). If the calling goroutine gets scheduled before the mcall returns, this stack-allocated closure will become invalid while it's still executing. One consequence of this we've observed is that the captured gp variable can get overwritten before the call to execute(gp), causing execute(gp) to segfault. Fix this by passing the currently captured gp variable through a field in the calling goroutine's g struct so that the func is no longer a closure. To prevent problems like this in the future, this change also removes the go:noescape annotation from mcall. Due to a compiler bug, this will currently cause a func closure passed to mcall to be implicitly allocated rather than refusing the implicit allocation. However, this is okay because there are no other closures passed to mcall right now and the compiler bug will be fixed shortly. Fixes #10428. Change-Id: I49b48b85de5643323b89e9eaa4df63854e968c32 Reviewed-on: https://go-review.googlesource.com/8866 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
-
Rob Pike authored
Change-Id: I8029640fe74731d7847390f371af37b85dec96cc Reviewed-on: https://go-review.googlesource.com/9006Reviewed-by: Rob Pike <r@golang.org>
-
Rob Pike authored
Trivial to do, but overlooked for 1.4, which is good because I prefer the new design, which is just to match against the source code of the line rather than the command word alone. Change-Id: Idcf7c4479e97bb7cd732f0d058012321b6057628 Reviewed-on: https://go-review.googlesource.com/9005Reviewed-by: Russ Cox <rsc@golang.org>
-
Brad Fitzpatrick authored
Change-Id: Id1ecad2565edd5937a764dcf56b89263353f47c2 Reviewed-on: https://go-review.googlesource.com/8947Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
-
Michael Matloob authored
Fixes #10319 Change-Id: I96015b0e1dff30a72de11fea3837638b5c672891 Reviewed-on: https://go-review.googlesource.com/8501Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
-
Hyang-Ah Hana Kim authored
Followed the same test pattern in misc/cgo/testcarchive. Change-Id: I2f863b5c24a28f0b38b0128ed3e8a92c17fb5b9f Reviewed-on: https://go-review.googlesource.com/8985Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-