summaryrefslogtreecommitdiff
path: root/src/cmd/gc
Commit message (Collapse)AuthorAgeFilesLines
* all: merge dev.garbage (d1238958d4ae) into default branchRuss Cox2014-12-051-4/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | When we start work on Gerrit, ppc64 and garbage collection work will continue in the master branch, not the dev branches. (We may still use dev branches for other things later, but these are ready to be merged, and doing it now, before moving to Git means we don't have to have dev branches working in the Gerrit workflow on day one.) TBR=rlh CC=golang-codereviews https://codereview.appspot.com/183140043
* \ [dev.garbage] all: merge dev.cc (493ad916c3b1) into dev.garbageRuss Cox2014-11-241-1/+0
|\ \ | |/ | | | | | | | | TBR=austin CC=golang-codereviews https://codereview.appspot.com/179290043
| * [dev.cc] cmd/gc: fix warning on Plan 9David du Colombier2014-11-171-1/+0
| | | | | | | | | | | | | | | | | | warning: src/cmd/gc/walk.c:1769 set and not used: on LGTM=rsc R=rsc, minux CC=golang-codereviews https://codereview.appspot.com/175850043
* | [dev.garbage] all: merge dev.cc into dev.garbageRuss Cox2014-11-156-34/+278
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | The garbage collector is now written in Go. There is plenty to clean up (just like on dev.cc). all.bash passes on darwin/amd64, darwin/386, linux/amd64, linux/386. TBR=rlh R=austin, rlh, bradfitz CC=golang-codereviews https://codereview.appspot.com/173250043
| * [dev.cc] all: merge dev.power64 (7667e41f3ced) into dev.ccRuss Cox2014-11-147-54/+289
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes. These are the files that had merge conflicts and have been edited by hand: malloc.go mem_linux.go mgc.go os1_linux.go proc1.go panic1.go runtime1.go LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/174180043
| | * [dev.cc] cmd/gc: changes for removing runtime C codeRuss Cox2014-11-117-52/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] export.c, lex.c: Add -asmhdr flag to write assembly header file with struct field offsets and const values. cmd/dist used to construct this file by interpreting output from the C compiler. Generate it from the Go definitions instead. Also, generate the form we need directly, instead of relying on cmd/dist for reprocessing. lex.c, obj.c: If the C compiler accepted #pragma cgo_xxx, recognize a directive //go:cgo_xxx instead. The effect is the same as in the C compiler: accumulate text into a buffer and emit in the output file, where the linker will find and use it. lex.c, obj.c: Accept //go:linkname to control the external symbol name used for a particular top-level Go variable. This makes it possible to refer to C symbol names but also symbols from other packages. It has always been possible to do this from C and assembly. To drive home the point that this should not be done lightly, require import "unsafe" in any file containing //go:linkname. plive.c, reflect.c, subr.c: Hard-code that interfaces contain only pointers. This means code handling multiword values in the garbage collector and the stack copier can be deleted instead of being converted. This change is already present in the dev.garbage branch. LGTM=r R=r CC=austin, golang-codereviews, iant, khr https://codereview.appspot.com/169360043
* | | [dev.garbage] all: merge dev.power64 (7667e41f3ced) into dev.garbageRuss Cox2014-11-142-18/+28
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the only difference between dev.cc and dev.garbage is the runtime conversion on the one side and the garbage collection on the other. They both have the same set of changes from default and dev.power64. LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/172570043
| * | [dev.power64] gc: convert Bits to a uint64 arrayAustin Clements2014-11-042-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far all of our architectures have had at most 32 registers, so we've been able to use entry 0 in the Bits uint32 array directly as a register mask. Power64 has 64 registers, so this converts Bits to a uint64 array so we can continue to use entry 0 directly as a register mask on Power64. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/169060043
| * | [dev.power64] 9g: fix niloptAustin Clements2014-11-031-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, nilopt was disabled on power64x because it threw away "seemly random segments of code." Indeed, excise on power64x failed to preserve the link field, so it excised not only the requested instruction but all following instructions in the function. Fix excise to retain the link field while otherwise zeroing the instruction. This makes nilopt safe on power64x. It still fails nilptr3.go's tests for removal of repeated nil checks because those depend on also optimizing away repeated loads, which doesn't currently happen on power64x. LGTM=dave, rsc R=rsc, dave CC=golang-codereviews https://codereview.appspot.com/168120043
* | | [dev.garbage] all: merge default (f38460037b72) into dev.garbageRuss Cox2014-11-149-36/+140
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | This is the revision that dev.cc is branched from. LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/169590043
| * | [dev.garbage] cmd/gc: emit pointer write barriersRuss Cox2014-11-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This got lost in the change that added the writebarrierfat variants. LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/165510043
| * | [dev.garbage] cmd/gc, runtime: add locks around print statementsRuss Cox2014-11-054-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now each C printf, Go print, or Go println is guaranteed not to be interleaved with other calls of those functions. This should help when debugging concurrent failures. LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/169120043
| * | [dev.garbage] cmd/gc, runtime: implement write barriers in terms of ↵Russ Cox2014-10-304-18/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | writebarrierptr This CL implements the many multiword write barriers by calling writebarrierptr, so that only writebarrierptr needs the actual barrier. In lieu of an actual barrier, writebarrierptr checks that the value being copied is not a small non-zero integer. This is enough to shake out bugs where the barrier is being called when it should not (for non-pointer values). It also found a few tests in sync/atomic that were being too clever. This CL adds a write barrier for the memory moved during the builtin copy function, which I forgot when inserting barriers for Go 1.4. This CL re-enables some write barriers that were disabled for Go 1.4. Those were disabled because it is possible to change the generated code so that they are unnecessary most of the time, but we have not changed the generated code yet. For safety they must be enabled. None of this is terribly efficient. We are aiming for correct first. LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/168770043
| * | [dev.garbage] all: merge dev.power64 (5ad5e85cfb99) into dev.garbageRuss Cox2014-10-293-2/+13
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal here is to get the big-endian fixes so that in some upcoming code movement for write barriers I don't make them unmergeable. LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/166890043
| | * [dev.power64] all: merge default (dd5014ed9b01) into dev.power64Russ Cox2014-10-293-2/+13
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Still passes on amd64. LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/165110043
| | | * [dev.power64] all: merge default into dev.power64Austin Clements2014-10-273-2/+13
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/164110043
| | | | * [dev.power64] all: merge default into dev.power64Austin Clements2014-10-223-2/+13
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings dev.power64 up-to-date with the current tip of default. go_bootstrap is still panicking with a bad defer when initializing the runtime (even on amd64). LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/152570049
| | | | | * build: merge the great pkg/ rename into dev.power64Austin Clements2014-10-227-28/+28
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also removes pkg/runtime/traceback_lr.c, which was ported to Go in an earlier commit and then moved to runtime/traceback.go. Reviewer: rsc@golang.org rsc: LGTM
| | | | | * \ [dev.power64] build: merge default into dev.power64Austin Clements2014-10-2218-192/+244
| | | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/160200044
| | | | | * | | [dev.power64] runtime: make all bitmaps arrays of bytesRuss Cox2014-08-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "simpler faster garbage collector" is full of little-endian assumptions. Instead of trying to correct all the mistakes, just give in and make everything use bytes. LGTM=minux R=minux CC=dvyukov, golang-codereviews https://codereview.appspot.com/124400043
| | | | | * | | [dev.power64] cmd/gc: disable magic multiply optimizations for nowShenghou Ma2014-08-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LGTM=rsc R=rsc, iant CC=golang-codereviews https://codereview.appspot.com/126110043
| | | | | * | | [dev.power64] cmd/9g, cmd/gc, cmd/ld: fix build.Shenghou Ma2014-08-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. disable nonsplit stack overflow check 2. disable OLROT recognition 3. emit correct instructions for adding offsets to an address LGTM=rsc R=rsc, iant CC=golang-codereviews https://codereview.appspot.com/123310043
| | | | | * | | [dev.power64] cmd/gc: handle thechar=='9', disable nilopt() for nowShenghou Ma2014-08-122-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LGTM=rsc R=rsc, iant, dave CC=golang-codereviews https://codereview.appspot.com/121630043
| * | | | | | | [dev.garbage] all: merge default (dd5014ed9b01) into dev.garbageRuss Cox2014-10-292-18/+9
| |\ \ \ \ \ \ \ | | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/170730043
| | * | | | | | all: merge default branch into dev.garbageRuss Cox2014-10-169-22/+78
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hg was unable to create a CL on the code review server for this, so I am submitting the merge by hand. The only manual edits are in mgc0.c, to reapply the removal of cached/ncached to the new code.
| | * \ \ \ \ \ \ [dev.garbage] merge default into dev.garbageRuss Cox2014-10-039-299/+321
| | |\ \ \ \ \ \ \
| | * | | | | | | | [dev.garbage] runtime: remove another BitsMultiWordRuss Cox2014-10-021-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not found because it was not used by name. Add name in comments for what's left behind. LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/148430043
| | * | | | | | | | [dev.garbage] cmd/gc: never generate BitsMultiWordRuss Cox2014-10-011-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LGTM=rlh R=rlh, minux CC=golang-codereviews https://codereview.appspot.com/151940043
* | | | | | | | | | gc: abort if given an unknown debug (-d) flagAustin Clements2014-11-041-2/+2
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for unknown command line debug flags in gc was incorrect: the loop over debugtab terminates when it reaches a nil entry, but it was only reporting an error if the parser had passed the last entry of debugtab (which it never did). Fix this by reporting the usage error if the loop reaches a nil entry. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/166110043
* | | | | | | | | cmd/gc: fix build - remove unused variables in walkprintRuss Cox2014-10-281-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TBR=austin CC=golang-codereviews https://codereview.appspot.com/162420043
* | | | | | | | | cmd/gc: fix internal compiler error in struct compareRuss Cox2014-10-281-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 9006. LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/167800043
* | | | | | | | | cmd/gc: avoid use of goprintfRuss Cox2014-10-283-117/+111
| |_|_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | goprintf is a printf-like print for Go. It is used in the code generated by 'defer print(...)' and 'go print(...)'. Normally print(1, 2, 3) turns into printint(1) printint(2) printint(3) but defer and go need a single function call to give the runtime; they give the runtime something like goprintf("%d%d%d", 1, 2, 3). Variadic functions like goprintf cannot be described in the new type information world, so we have to replace it. Replace with a custom function, so that defer print(1, 2, 3) turns into defer func(a1, a2, a3 int) { print(a1, a2, a3) }(1, 2, 3) (and then the print becomes three different printints as usual). Fixes issue 8614. LGTM=austin R=austin CC=golang-codereviews, r https://codereview.appspot.com/159700043
* | | | | | | | cmd/gc: synthesize zeroed value for non-assignment contextRuss Cox2014-10-241-7/+1
| |_|_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CL 157910047 introduced code to turn a node representing a zeroed composite literal into N, the nil Node* pointer (which represents any zero, not the Go literal nil). That's great for assignments like x = T{}, but it doesn't work when T{} is used in a value context like T{}.v or x == T{}. Fix those. Should have no effect on performance; confirmed. The deltas below are noise (compare ns/op): benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 2902919192 2915228424 +0.42% BenchmarkFannkuch11 2597417605 2630363685 +1.27% BenchmarkFmtFprintfEmpty 73.7 74.8 +1.49% BenchmarkFmtFprintfString 196 199 +1.53% BenchmarkFmtFprintfInt 213 217 +1.88% BenchmarkFmtFprintfIntInt 336 356 +5.95% BenchmarkFmtFprintfPrefixedInt 289 294 +1.73% BenchmarkFmtFprintfFloat 415 416 +0.24% BenchmarkFmtManyArgs 1281 1271 -0.78% BenchmarkGobDecode 10271734 10307978 +0.35% BenchmarkGobEncode 8985021 9079442 +1.05% BenchmarkGzip 410233227 412266944 +0.50% BenchmarkGunzip 102114554 103272443 +1.13% BenchmarkHTTPClientServer 45297 44993 -0.67% BenchmarkJSONEncode 19499741 19498489 -0.01% BenchmarkJSONDecode 76436733 74247497 -2.86% BenchmarkMandelbrot200 4273814 4307292 +0.78% BenchmarkGoParse 4024594 4028937 +0.11% BenchmarkRegexpMatchEasy0_32 131 135 +3.05% BenchmarkRegexpMatchEasy0_1K 328 333 +1.52% BenchmarkRegexpMatchEasy1_32 115 117 +1.74% BenchmarkRegexpMatchEasy1_1K 931 948 +1.83% BenchmarkRegexpMatchMedium_32 216 217 +0.46% BenchmarkRegexpMatchMedium_1K 72669 72857 +0.26% BenchmarkRegexpMatchHard_32 3818 3809 -0.24% BenchmarkRegexpMatchHard_1K 121398 121945 +0.45% BenchmarkRevcomp 613996550 615145436 +0.19% BenchmarkTemplate 93678525 93267391 -0.44% BenchmarkTimeParse 414 411 -0.72% BenchmarkTimeFormat 396 399 +0.76% Fixes issue 8947. LGTM=r R=r, dave CC=golang-codereviews https://codereview.appspot.com/162130043
* | | | | | | cmd/gc: disallow call of *T method using **T variableRuss Cox2014-10-201-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings cmd/gc in line with the spec on this question. It might break existing code, but that code was not conformant with the spec. Credit to R?my for finding the broken code. Fixes issue 6366. LGTM=r R=golang-codereviews, r CC=adonovan, golang-codereviews, gri https://codereview.appspot.com/129550043
* | | | | | | cmd/gc: emit code for extern = <N>Daniel Morsing2014-10-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.appspot.com/152700045/ made it possible for struct literals assigned to globals to use <N> as the RHS. Normally, this is to zero out variables on first use. Because globals are already zero (or their linker initialized value), we just ignored this. Now that <N> can occur from non-initialization code, we need to emit this code. We don't use <N> for initialization of globals any more, so this shouldn't cause any excessive zeroing. Fixes issue 8961. LGTM=rsc R=golang-codereviews, rsc CC=bradfitz, golang-codereviews https://codereview.appspot.com/154540044
* | | | | | | cmd/gc: don't use static init to initialize small structs, fieldsRuss Cox2014-10-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Better to avoid the memory loads and just use immediate constants. This especially applies to zeroing, which was being done by copying zeros from elsewhere in the binary, even if the value was going to be completely initialized with non-zero values. The zero writes were optimized away but the zero loads from the data segment were not. LGTM=r R=r, bradfitz, dvyukov CC=golang-codereviews https://codereview.appspot.com/152700045
* | | | | | | cmd/gc: elide write barrier for x = x[0:y] and x = append(x, ...)Russ Cox2014-10-163-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both of these forms can avoid writing to the base pointer in x (in the slice, always, and in the append, most of the time). For Go 1.5, will need to change the compilation of x = x[0:y] to avoid writing to the base pointer, so that the elision is safe, and will need to change the compilation of x = append(x, ...) to write to the base pointer (through a barrier) only when growing the underlying array, so that the general elision is safe. For Go 1.4, elide the write barrier always, a change that should have equivalent performance characteristics but is much simpler and therefore safer. benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 3910526122 3918802545 +0.21% BenchmarkFannkuch11 3747650699 3732600693 -0.40% BenchmarkFmtFprintfEmpty 106 98.7 -6.89% BenchmarkFmtFprintfString 280 269 -3.93% BenchmarkFmtFprintfInt 296 282 -4.73% BenchmarkFmtFprintfIntInt 467 470 +0.64% BenchmarkFmtFprintfPrefixedInt 418 398 -4.78% BenchmarkFmtFprintfFloat 574 535 -6.79% BenchmarkFmtManyArgs 1768 1818 +2.83% BenchmarkGobDecode 14916799 14925182 +0.06% BenchmarkGobEncode 14110076 13358298 -5.33% BenchmarkGzip 546609795 542630402 -0.73% BenchmarkGunzip 136270657 136496277 +0.17% BenchmarkHTTPClientServer 126574 125245 -1.05% BenchmarkJSONEncode 30006238 27862354 -7.14% BenchmarkJSONDecode 106020889 102664600 -3.17% BenchmarkMandelbrot200 5793550 5818320 +0.43% BenchmarkGoParse 5437608 5463962 +0.48% BenchmarkRegexpMatchEasy0_32 192 179 -6.77% BenchmarkRegexpMatchEasy0_1K 462 460 -0.43% BenchmarkRegexpMatchEasy1_32 168 153 -8.93% BenchmarkRegexpMatchEasy1_1K 1420 1280 -9.86% BenchmarkRegexpMatchMedium_32 338 286 -15.38% BenchmarkRegexpMatchMedium_1K 107435 98027 -8.76% BenchmarkRegexpMatchHard_32 5941 4846 -18.43% BenchmarkRegexpMatchHard_1K 185965 153830 -17.28% BenchmarkRevcomp 795497458 798447829 +0.37% BenchmarkTemplate 132091559 134938425 +2.16% BenchmarkTimeParse 604 608 +0.66% BenchmarkTimeFormat 551 548 -0.54% LGTM=r R=r, dave CC=golang-codereviews, iant, khr, rlh https://codereview.appspot.com/159960043
* | | | | | | cmd/gc: simplify compiled code for explicit zeroingRuss Cox2014-10-155-9/+13
| |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other things, *x = T{} does not need a write barrier. The changes here avoid an unnecessary copy even when no pointers are involved, so it may have larger effects. In 6g and 8g, avoid manually repeated STOSQ in favor of writing explicit MOVs, under the theory that the MOVs should have fewer dependencies and pipeline better. Benchmarks compare best of 5 on a 2012 MacBook Pro Core i5 with TurboBoost disabled. Most improvements can be explained by the changes in this CL. The effect in Revcomp is real but harder to explain: none of the instructions in the inner loop changed. I suspect loop alignment but really have no idea. benchmark old new delta BenchmarkBinaryTree17 3809027371 3819907076 +0.29% BenchmarkFannkuch11 3607547556 3686983012 +2.20% BenchmarkFmtFprintfEmpty 118 103 -12.71% BenchmarkFmtFprintfString 289 277 -4.15% BenchmarkFmtFprintfInt 304 290 -4.61% BenchmarkFmtFprintfIntInt 507 458 -9.66% BenchmarkFmtFprintfPrefixedInt 425 408 -4.00% BenchmarkFmtFprintfFloat 555 555 +0.00% BenchmarkFmtManyArgs 1835 1733 -5.56% BenchmarkGobDecode 14738209 14639331 -0.67% BenchmarkGobEncode 14239039 13703571 -3.76% BenchmarkGzip 538211054 538701315 +0.09% BenchmarkGunzip 135430877 134818459 -0.45% BenchmarkHTTPClientServer 116488 116618 +0.11% BenchmarkJSONEncode 28923406 29294334 +1.28% BenchmarkJSONDecode 105779820 104289543 -1.41% BenchmarkMandelbrot200 5791758 5771964 -0.34% BenchmarkGoParse 5376642 5310943 -1.22% BenchmarkRegexpMatchEasy0_32 195 190 -2.56% BenchmarkRegexpMatchEasy0_1K 477 455 -4.61% BenchmarkRegexpMatchEasy1_32 170 165 -2.94% BenchmarkRegexpMatchEasy1_1K 1410 1394 -1.13% BenchmarkRegexpMatchMedium_32 336 329 -2.08% BenchmarkRegexpMatchMedium_1K 108979 106328 -2.43% BenchmarkRegexpMatchHard_32 5854 5821 -0.56% BenchmarkRegexpMatchHard_1K 185089 182838 -1.22% BenchmarkRevcomp 834920364 780202624 -6.55% BenchmarkTemplate 137046937 129728756 -5.34% BenchmarkTimeParse 600 594 -1.00% BenchmarkTimeFormat 559 539 -3.58% LGTM=r R=r CC=golang-codereviews, iant, khr, rlh https://codereview.appspot.com/157910047
* | | | | | cmd/gc: do not copy via temporary for writebarrierfat{2,3,4}Russ Cox2014-10-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The general writebarrierfat needs a temporary for src, because we need to pass the address of the temporary to the writebarrierfat routine. But the new fixed-size ones pass the value directly and don't need to introduce the temporary. Magnifies some of the effect of the custom write barrier change. Comparing best of 5 with TurboBoost turned off, on a 2012 Retina MacBook Pro Core i5. Still not completely confident in these numbers, but the fmt, regexp, and revcomp improvements seem real. benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 3942965521 3929654940 -0.34% BenchmarkFannkuch11 3707543350 3699566011 -0.22% BenchmarkFmtFprintfEmpty 119 119 +0.00% BenchmarkFmtFprintfString 295 296 +0.34% BenchmarkFmtFprintfInt 313 314 +0.32% BenchmarkFmtFprintfIntInt 517 484 -6.38% BenchmarkFmtFprintfPrefixedInt 439 429 -2.28% BenchmarkFmtFprintfFloat 571 569 -0.35% BenchmarkFmtManyArgs 1899 1820 -4.16% BenchmarkGobDecode 15507208 15325649 -1.17% BenchmarkGobEncode 14811710 14715434 -0.65% BenchmarkGzip 561144467 549624323 -2.05% BenchmarkGunzip 137377667 137691087 +0.23% BenchmarkHTTPClientServer 126632 124717 -1.51% BenchmarkJSONEncode 29944112 29526629 -1.39% BenchmarkJSONDecode 108954913 107339551 -1.48% BenchmarkMandelbrot200 5828755 5821659 -0.12% BenchmarkGoParse 5577437 5521895 -1.00% BenchmarkRegexpMatchEasy0_32 198 193 -2.53% BenchmarkRegexpMatchEasy0_1K 486 469 -3.50% BenchmarkRegexpMatchEasy1_32 175 167 -4.57% BenchmarkRegexpMatchEasy1_1K 1450 1419 -2.14% BenchmarkRegexpMatchMedium_32 344 338 -1.74% BenchmarkRegexpMatchMedium_1K 112088 109855 -1.99% BenchmarkRegexpMatchHard_32 6078 6003 -1.23% BenchmarkRegexpMatchHard_1K 191166 187499 -1.92% BenchmarkRevcomp 854870445 799012851 -6.53% BenchmarkTemplate 141572691 141508105 -0.05% BenchmarkTimeParse 604 603 -0.17% BenchmarkTimeFormat 579 560 -3.28% LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/155450043
* | | | | | cmd/gc: blank methods are not permitted in interface typesChris Manghane2014-10-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 6606. LGTM=rsc R=rsc CC=golang-codereviews, gri https://codereview.appspot.com/156210044
* | | | | | cmd/gc, runtime: fix race, nacl for writebarrier changesRuss Cox2014-10-144-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The racewalk code was not updated for the new write barriers. Make it more future-proof. The new write barrier code assumed that +1 pointer would be aligned properly for any type that might follow, but that's not true on 32-bit systems where some types are 64-bit aligned. The only system like that today is nacl/amd64p32. Insert a dummy pointer so that the ambiguously typed value is at +2 pointers, which is always max-aligned. LGTM=r R=r CC=golang-codereviews, iant, khr https://codereview.appspot.com/158890046
* | | | | | cmd/gc: check for initialization cycles in method valuesChris Manghane2014-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 7960. LGTM=rsc R=rsc CC=golang-codereviews, gri https://codereview.appspot.com/159800045
* | | | | | cmd/gc: add 2-, 3-, 4-word write barrier specializationsRuss Cox2014-10-143-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assignments of 2-, 3-, and 4-word values were handled by individual MOV instructions (and for scalars still are). But if there are pointers involved, those assignments now go through the write barrier routine. Before this CL, they went to writebarrierfat, which calls memmove. Memmove is too much overhead for these small amounts of data. Instead, call writebarrierfat{2,3,4}, which are specialized for the specific amount of data being copied. Today the write barrier does not care which words are pointers, so size alone is enough to distinguish the cases. If we keep these distinctions in Go 1.5 we will need to expand them for all the pointer-vs-scalar possibilities, so the current 3 functions will become 3+7+15 = 25, still not a large burden (we deleted more morestack functions than that when we dropped segmented stacks). BenchmarkBinaryTree17 3250972583 3123910344 -3.91% BenchmarkFannkuch11 3067605223 2964737839 -3.35% BenchmarkFmtFprintfEmpty 101 96.0 -4.95% BenchmarkFmtFprintfString 267 235 -11.99% BenchmarkFmtFprintfInt 261 253 -3.07% BenchmarkFmtFprintfIntInt 444 402 -9.46% BenchmarkFmtFprintfPrefixedInt 374 346 -7.49% BenchmarkFmtFprintfFloat 472 449 -4.87% BenchmarkFmtManyArgs 1537 1476 -3.97% BenchmarkGobDecode 13986528 12432985 -11.11% BenchmarkGobEncode 13120323 12537420 -4.44% BenchmarkGzip 451925758 437500578 -3.19% BenchmarkGunzip 113267612 110053644 -2.84% BenchmarkHTTPClientServer 103151 77100 -25.26% BenchmarkJSONEncode 25002733 23435278 -6.27% BenchmarkJSONDecode 94213717 82568789 -12.36% BenchmarkMandelbrot200 4804246 4713070 -1.90% BenchmarkGoParse 4646114 4379456 -5.74% BenchmarkRegexpMatchEasy0_32 163 158 -3.07% BenchmarkRegexpMatchEasy0_1K 433 391 -9.70% BenchmarkRegexpMatchEasy1_32 154 138 -10.39% BenchmarkRegexpMatchEasy1_1K 1481 1132 -23.57% BenchmarkRegexpMatchMedium_32 282 270 -4.26% BenchmarkRegexpMatchMedium_1K 92421 86149 -6.79% BenchmarkRegexpMatchHard_32 5209 4718 -9.43% BenchmarkRegexpMatchHard_1K 158141 147921 -6.46% BenchmarkRevcomp 699818791 642222464 -8.23% BenchmarkTemplate 132402383 108269713 -18.23% BenchmarkTimeParse 509 478 -6.09% BenchmarkTimeFormat 462 456 -1.30% LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/156200043
* | | | | | cmd/gc: fix 'make' in cmd/gc directoryRuss Cox2014-10-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, go tool 6g -A fails complaining about 'any' type. TBR=r CC=golang-codereviews https://codereview.appspot.com/156200044
* | | | | | cmd/gc: fix print formatRuss Cox2014-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes 386 build. TBR=r CC=golang-codereviews https://codereview.appspot.com/149620043
* | | | | | runtime: remove type-punning for Type.gc[0], gc[1]Russ Cox2014-10-071-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on flags&KindGCProg, gc[0] and gc[1] are either pointers or inlined bitmap bits. That's not compatible with a precise garbage collector: it needs to be always pointers or never pointers. Change the inlined bitmap case to store a pointer to an out-of-line bitmap in gc[0]. The out-of-line bitmaps are dedup'ed, so that for example all pointer types share the same out-of-line bitmap. Fixes issue 8864. LGTM=r R=golang-codereviews, dvyukov, r CC=golang-codereviews, iant, khr, rlh https://codereview.appspot.com/155820043
* | | | | | cmd/gc: prohibit short variable declarations containing duplicate symbolsEvan Kroske2014-10-061-0/+11
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 6764. Fixes issue 8435. LGTM=rsc R=golang-codereviews, r, gobot, rsc CC=golang-codereviews https://codereview.appspot.com/116440046 Committer: Russ Cox <rsc@golang.org>
* | | | | cmd/gc: fix call order in array literal of slice literal of make chanRuss Cox2014-09-301-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 8761. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://codereview.appspot.com/144530045
* | | | | cmd/gc: emit error for out-of-bounds slice of constant stringRuss Cox2014-09-251-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 7200. LGTM=gri, iant R=golang-codereviews, gri, iant CC=golang-codereviews, r https://codereview.appspot.com/150020044
* | | | | cmd/gc: print x++ (not x += 1) in errors about x++Russ Cox2014-09-254-262/+277
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 8311. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://codereview.appspot.com/146270043