aboutsummaryrefslogtreecommitdiff
path: root/src/sync/atomic
AgeCommit message (Collapse)Author
2018-03-22cmd/compile/internal/ppc64, runtime internal/atomic, sync/atomic: implement ↵Carlos Eduardo Seo
faster atomics for ppc64x This change implements faster atomics for ppc64x based on the ISA 2.07B, Appendix B.2 recommendations, replacing SYNC/ISYNC by LWSYNC in some cases. Updates #21348 name old time/op new time/op delta Cond1-16 955ns 856ns -10.33% Cond2-16 2.38µs 2.03µs -14.59% Cond4-16 5.90µs 5.44µs -7.88% Cond8-16 12.1µs 11.1µs -8.42% Cond16-16 27.0µs 25.1µs -7.04% Cond32-16 59.1µs 55.5µs -6.14% LoadMostlyHits/*sync_test.DeepCopyMap-16 22.1ns 24.1ns +9.02% LoadMostlyHits/*sync_test.RWMutexMap-16 252ns 249ns -1.20% LoadMostlyHits/*sync.Map-16 16.2ns 16.3ns ~ LoadMostlyMisses/*sync_test.DeepCopyMap-16 22.3ns 22.6ns ~ LoadMostlyMisses/*sync_test.RWMutexMap-16 249ns 247ns -0.51% LoadMostlyMisses/*sync.Map-16 12.7ns 12.7ns ~ LoadOrStoreBalanced/*sync_test.RWMutexMap-16 1.27µs 1.17µs -7.54% LoadOrStoreBalanced/*sync.Map-16 1.12µs 1.10µs -2.35% LoadOrStoreUnique/*sync_test.RWMutexMap-16 1.75µs 1.68µs -3.84% LoadOrStoreUnique/*sync.Map-16 2.07µs 1.97µs -5.13% LoadOrStoreCollision/*sync_test.DeepCopyMap-16 15.8ns 15.9ns ~ LoadOrStoreCollision/*sync_test.RWMutexMap-16 496ns 424ns -14.48% LoadOrStoreCollision/*sync.Map-16 6.07ns 6.07ns ~ Range/*sync_test.DeepCopyMap-16 1.65µs 1.64µs ~ Range/*sync_test.RWMutexMap-16 278µs 288µs +3.75% Range/*sync.Map-16 2.00µs 2.01µs ~ AdversarialAlloc/*sync_test.DeepCopyMap-16 3.45µs 3.44µs ~ AdversarialAlloc/*sync_test.RWMutexMap-16 226ns 227ns ~ AdversarialAlloc/*sync.Map-16 1.09µs 1.07µs -2.36% AdversarialDelete/*sync_test.DeepCopyMap-16 553ns 550ns -0.57% AdversarialDelete/*sync_test.RWMutexMap-16 273ns 274ns ~ AdversarialDelete/*sync.Map-16 247ns 249ns ~ UncontendedSemaphore-16 79.0ns 65.5ns -17.11% ContendedSemaphore-16 112ns 97ns -13.77% MutexUncontended-16 3.34ns 2.51ns -24.69% Mutex-16 266ns 191ns -28.26% MutexSlack-16 226ns 159ns -29.55% MutexWork-16 377ns 338ns -10.14% MutexWorkSlack-16 335ns 308ns -8.20% MutexNoSpin-16 196ns 184ns -5.91% MutexSpin-16 710ns 666ns -6.21% Once-16 1.29ns 1.29ns ~ Pool-16 8.64ns 8.71ns ~ PoolOverflow-16 1.60µs 1.44µs -10.25% SemaUncontended-16 5.39ns 4.42ns -17.96% SemaSyntNonblock-16 539ns 483ns -10.42% SemaSyntBlock-16 413ns 354ns -14.20% SemaWorkNonblock-16 305ns 258ns -15.36% SemaWorkBlock-16 266ns 229ns -14.06% RWMutexUncontended-16 12.9ns 9.7ns -24.80% RWMutexWrite100-16 203ns 147ns -27.47% RWMutexWrite10-16 177ns 119ns -32.74% RWMutexWorkWrite100-16 435ns 403ns -7.39% RWMutexWorkWrite10-16 642ns 611ns -4.79% WaitGroupUncontended-16 4.67ns 3.70ns -20.92% WaitGroupAddDone-16 402ns 355ns -11.54% WaitGroupAddDoneWork-16 208ns 250ns +20.09% WaitGroupWait-16 1.21ns 1.21ns ~ WaitGroupWaitWork-16 5.91ns 5.87ns -0.81% WaitGroupActuallyWait-16 92.2ns 85.8ns -6.91% Updates #21348 Change-Id: Ibb9b271d11b308264103829e176c6d9fe8f867d3 Reviewed-on: https://go-review.googlesource.com/95175 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2018-03-21runtime,sync/atomic: replace asm BYTEs with insts for x86isharipo
For each replacement, test case is added to new 386enc.s file with exception of EMMS, SYSENTER, MFENCE and LFENCE as they are already covered in amd64enc.s (same on amd64 and 386). The replacement became less obvious after go vet suggested changes Before: BYTE $0x0f; BYTE $0x7f; BYTE $0x44; BYTE $0x24; BYTE $0x08 Changed to MOVQ (this form is being tested): MOVQ M0, 8(SP) Refactored to FP-relative access (go vet advice): MOVQ M0, val+4(FP) Change-Id: I56b87cf3371b6ad81ad0cd9db2033aee407b5818 Reviewed-on: https://go-review.googlesource.com/101475 Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2018-02-12runtime, sync/atomic: use NOFRAME on armAustin Clements
This replaces frame size -4 with the NOFRAME flag in arm assembly. This was automated with: sed -i -e 's/\(^TEXT.*[A-Z]\),\( *\)\$-4/\1|NOFRAME,\2$0/' $(find -name '*_arm.s') Plus three manual comment changes found by: grep '\$-4' $(find -name '*_arm.s') The go binary is identical before and after this change. Change-Id: I0310384d1a584118c41d1cd3a042bb8ea7227ef9 Reviewed-on: https://go-review.googlesource.com/92042 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-12-01sync/atomic: remove noCopy from ValueRuss Cox
Values must not be copied after the first use. Using noCopy makes vet complain about copies even before the first use, which is incorrect and very frustrating. Drop it. Fixes #21504. Change-Id: Icd3a5ac3fe11e84525b998e848ed18a5d996f45a Reviewed-on: https://go-review.googlesource.com/80836 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-04all: change github.com issue links to golang.orgLeigh McCulloch
The go repository contains a mix of github.com/golang/go/issues/xxxxx and golang.org/issues/xxxxx URLs for references to issues in the issue tracker. We should use one for consistency, and golang.org is preferred in case the project moves the issue tracker in the future. This reasoning is taken from a comment Sam Whited left on a CL I recently opened: https://go-review.googlesource.com/c/go/+/73890. In that CL I referenced an issue using its github.com URL, because other tests in the file I was changing contained references to issues using their github.com URL. Sam Whited left a comment on the CL stating I should change it to the golang.org URL. If new code is intended to reference issues via golang.org and not github.com, existing code should be updated so that precedence exists for contributors who are looking at the existing code as a guide for the code they should write. Change-Id: I3b9053fe38a1c56fc101a8b7fd7b8f310ba29724 Reviewed-on: https://go-review.googlesource.com/75673 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-10-02sync/atomic: add memory barriers to Load/StoreInt32 on darwin/armElias Naur
After switching to an iPhone 5 for the darwin/arm builds, TestStoreLoadRelAcq32 started to timeout on every builder run. Adding the same memory barriers as armLoadUint64 and armStoreUint64 makes the test complete successfully. Fixes sync/atomic tests on the darwin/arm builder. Change-Id: Id73de31679304e259bdbd7f2f94383ae7fd70ee4 Reviewed-on: https://go-review.googlesource.com/67390 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2017-08-26all: remove some double spaces from commentsDaniel Martí
Went mainly for the ones that make no sense, such as the ones mid-sentence or after commas. Change-Id: Ie245d2c19cc7428a06295635cf6a9482ade25ff0 Reviewed-on: https://go-review.googlesource.com/57293 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-25sync/atomic: remove references to old atomic pointer hammer testsTom Levy
The tests were removed in https://golang.org/cl/2311 but some references to them were missed. Change-Id: I163e554a0cc99401a012deead8fda813ad74dbfe Reviewed-on: https://go-review.googlesource.com/58870 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-11sync/atomic: clarify 64-bit alignment bugAustin Clements
Local variables can also be relied on the be 64-bit aligned, since they will be escaped to the heap if used with any atomic operations. Also, allocated arrays are also aligned, just like structs and slices. Fixes #18955. Change-Id: I8a1897f6ff78922c8bfcf20d6eb4bcb17a70ba2d Reviewed-on: https://go-review.googlesource.com/48112 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-07sync: remove note about creating with structuresJoonas Kuorilehto
Remove note that sync.Cond, sync.Mutex, sync.RWMutex and atomic.Value can be created as part of other data structures. Structs can be embedded by default, and default should not be repeated. Fixes #20471. Change-Id: If3f5703d3f60abd96482b58ca43450d02a9e645a Reviewed-on: https://go-review.googlesource.com/44071 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-16cmd/internal/obj/mips: add support of LLV, SCV, NOOP instructionsCherry Zhang
LLV and SCV are 64-bit load-linked and store-conditional. They were used in runtime as #define WORD. Change them to normal instruction form. NOOP is hardware no-op. It was written as WORD $0. Make a name for it for better disassembly output. Fixes #12561. Fixes #18238. Change-Id: I82c667ce756fa83ef37b034b641e8c4366335e83 Reviewed-on: https://go-review.googlesource.com/40297 Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-19cmd/vet: skip unreachable "if" and "case" code in shift check.Aliaksandr Valialkin
Such dead code is legitimate when dealing with arch-specific types (int, uint, uintptr). The CL removes the majority of 'too small for shift' false positives from such a code. Change-Id: I62c5635a1d3774ab2d71d3d7056f0589f214cbe5 Reviewed-on: https://go-review.googlesource.com/38065 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2017-02-21sync/atomic: fix mipsx frame sizesJosh Bleecher Snyder
Found by vet. Change-Id: Ied3089a2cc8757ae5377fb5fa05bbb385d26ad9c Reviewed-on: https://go-review.googlesource.com/37307 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-22runtime/internal/atomic: crash on unaligned 64-bit ops on 32-bit MIPSCherry Zhang
This check was originally implemented by Vladimir in https://go-review.googlesource.com/c/31489/1/src/runtime/internal/atomic/atomic_mipsx.go#30 but removed due to my comment (Sorry!). This CL adds it back. Fixes #17786. Change-Id: I7ff4c2539fc9e2afd8199964b587a8ccf093b896 Reviewed-on: https://go-review.googlesource.com/33431 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-15all: don't call t.Fatal from a goroutineIan Lance Taylor
Fixes #17900. Change-Id: I42cda6ac9cf48ed739d3a015a90b3cb15edf8ddf Reviewed-on: https://go-review.googlesource.com/33243 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03sync/atomic: add support for GOARCH=mips{,le}Vladimir Stefanovic
Change-Id: I10f36710dd95b9bd31b3b82a3c32edcadb90ffa9 Reviewed-on: https://go-review.googlesource.com/31510 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03all: update s390x assembly to use vet-friendly namesJosh Bleecher Snyder
No functional changes. Change-Id: Ibf592c04be506a76577d48574e84ab20c3238b49 Reviewed-on: https://go-review.googlesource.com/32589 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Munday <munday@ca.ibm.com>
2016-08-30cmd/compile: intrinsify sync/atomic for amd64Keith Randall
Uses the same implementation as runtime/internal/atomic. Reorganize the intrinsic detector to make it more table-driven. Also works on amd64p32. Change-Id: I7a5238951d6018d7d5d1bc01f339f6ee9282b2d0 Reviewed-on: https://go-review.googlesource.com/28076 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-08-25all: fix assembly vet issuesJosh Bleecher Snyder
Add missing function prototypes. Fix function prototypes. Use FP references instead of SP references. Fix variable names. Update comments. Clean up whitespace. (Not for vet.) All fairly minor fixes to make vet happy. Updates #11041 Change-Id: Ifab2cdf235ff61cdc226ab1d84b8467b5ac9446c Reviewed-on: https://go-review.googlesource.com/27713 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06cmd/vet: check sync.* types' copyingAliaksandr Valialkin
Embed noLock struct into the following types, so `go vet -copylocks` catches their copying additionally to types containing sync.Mutex: - sync.Cond - sync.WaitGroup - sync.Pool - atomic.Value Fixes #14582 Change-Id: Icb543ef5ad10524ad239a15eec8a9b334b0e0660 Reviewed-on: https://go-review.googlesource.com/22015 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05sync/atomic, runtime/internal/atomic: improve ppc64x atomicsLynn Boger
The following performance improvements have been made to the low-level atomic functions for ppc64le & ppc64: - For those cases containing a lwarx and stwcx (or other sizes): sync, lwarx, maybe something, stwcx, loop to sync, sync, isync The sync is moved before (outside) the lwarx/stwcx loop, and the sync after is removed, so it becomes: sync, lwarx, maybe something, stwcx, loop to lwarx, isync - For the Or8 and And8, the shifting and manipulation of the address to the word aligned version were removed and the instructions were changed to use lbarx, stbcx instead of register shifting, xor, then lwarx, stwcx. - New instructions LWSYNC, LBAR, STBCC were tested and added. runtime/atomic_ppc64x.s was changed to use the LWSYNC opcode instead of the WORD encoding. Fixes #15469 Ran some of the benchmarks in the runtime and sync directories. Some results varied from run to run but the trend was improvement based on best times for base and new: runtime.test: BenchmarkChanNonblocking-128 0.88 0.89 +1.14% BenchmarkChanUncontended-128 569 511 -10.19% BenchmarkChanContended-128 63110 53231 -15.65% BenchmarkChanSync-128 691 598 -13.46% BenchmarkChanSyncWork-128 11355 11649 +2.59% BenchmarkChanProdCons0-128 2402 2090 -12.99% BenchmarkChanProdCons10-128 1348 1363 +1.11% BenchmarkChanProdCons100-128 1002 746 -25.55% BenchmarkChanProdConsWork0-128 2554 2720 +6.50% BenchmarkChanProdConsWork10-128 1909 1804 -5.50% BenchmarkChanProdConsWork100-128 1624 1580 -2.71% BenchmarkChanCreation-128 237 212 -10.55% BenchmarkChanSem-128 705 667 -5.39% BenchmarkChanPopular-128 5081190 4497566 -11.49% BenchmarkCreateGoroutines-128 532 473 -11.09% BenchmarkCreateGoroutinesParallel-128 35.0 34.7 -0.86% BenchmarkCreateGoroutinesCapture-128 4923 4200 -14.69% sync.test: BenchmarkUncontendedSemaphore-128 112 94.2 -15.89% BenchmarkContendedSemaphore-128 133 128 -3.76% BenchmarkMutexUncontended-128 1.90 1.67 -12.11% BenchmarkMutex-128 353 310 -12.18% BenchmarkMutexSlack-128 304 283 -6.91% BenchmarkMutexWork-128 554 541 -2.35% BenchmarkMutexWorkSlack-128 567 556 -1.94% BenchmarkMutexNoSpin-128 275 242 -12.00% BenchmarkMutexSpin-128 1129 1030 -8.77% BenchmarkOnce-128 1.08 0.96 -11.11% BenchmarkPool-128 29.8 27.4 -8.05% BenchmarkPoolOverflow-128 40564 36583 -9.81% BenchmarkSemaUncontended-128 3.14 2.63 -16.24% BenchmarkSemaSyntNonblock-128 1087 1069 -1.66% BenchmarkSemaSyntBlock-128 897 893 -0.45% BenchmarkSemaWorkNonblock-128 1034 1028 -0.58% BenchmarkSemaWorkBlock-128 949 886 -6.64% Change-Id: I4403fb29d3cd5254b7b1ce87a216bd11b391079e Reviewed-on: https://go-review.googlesource.com/22549 Reviewed-by: Michael Munday <munday@ca.ibm.com> Reviewed-by: Minux Ma <minux@golang.org>
2016-04-07sync/atomic: add s390x implementations of atomic functionsMichael Munday
Load and store instructions are atomic on s390x. Change-Id: I33c641a75954f4fbd301b11a467cb57872038880 Reviewed-on: https://go-review.googlesource.com/20947 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-02all: single space after period.Brad Fitzpatrick
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>
2016-03-01all: make copyright headers consistent with one space after periodBrad Fitzpatrick
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>
2016-02-26sync/atomic: new file for plan9_arm supportRichard Miller
Atomic load/store/add/swap routines, as for other ARM platforms, but with DMB inserted for load/store (assuming that "atomic" also implies acquire/release memory ordering). Change-Id: I70a283d8f0ae61a66432998ce59eac76fd940c67 Reviewed-on: https://go-review.googlesource.com/18965 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-26sync/atomic: reduce test in short modeDmitry Vyukov
In normal mode the test runs for 9+ seconds on my machine (48 cores). But the real problem is race mode, in race mode it hits 10m test timeout. Reduce test size in short mode. Now it runs for 100ms without race. Change-Id: I9493a0e84f630b930af8f958e2920025df37c268 Reviewed-on: https://go-review.googlesource.com/19956 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-12sync/atomic: added support for mips64{,le}Yao Zhang
Change-Id: Ibe6c345afd4cbae7e2542a350043fbb6b81d5678 Reviewed-on: https://go-review.googlesource.com/14450 Reviewed-by: Minux Ma <minux@golang.org>
2015-11-10runtime: break atomics out into package runtime/internal/atomicMichael Matloob
This change breaks out most of the atomics functions in the runtime into package runtime/internal/atomic. It adds some basic support in the toolchain for runtime packages, and also modifies linux/arm atomics to remove the dependency on the runtime's mutex. The mutexes have been replaced with spinlocks. all trybots are happy! In addition to the trybots, I've tested on the darwin/arm64 builder, on the darwin/arm builder, and on a ppc64le machine. Change-Id: I6698c8e3cf3834f55ce5824059f44d00dc8e3c2f Reviewed-on: https://go-review.googlesource.com/14204 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-30runtime, sync/atomic: add memory barriers in arm cas routinesRuss Cox
This only triggers on ARMv7+. If there are important SMP ARMv6 machines we can reconsider. Makes TestLFStress tests pass and sync/atomic tests not time out on Apple iPad Mini 3. Fixes #7977. Fixes #10189. Change-Id: Ie424dea3765176a377d39746be9aa8265d11bec4 Reviewed-on: https://go-review.googlesource.com/12950 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-30sync/atomic: reenable TestNilDeref everywhereRuss Cox
There is absolutely no information about how this was failing. If we reenable the test then at least we can get a build log from darwin/arm. There are not even freebsd/arm or netbsd/arm builders, so not too worried about those. (That is another problem.) Change-Id: I0e739a4dd2897adbe110aa400d720d8fa02ae65f Reviewed-on: https://go-review.googlesource.com/12920 Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-06all: use RET instead of RETURN on ppc64Austin Clements
All of the architectures except ppc64 have only "RET" for the return mnemonic. ppc64 used to have only "RETURN", but commit cf06ea6 introduced RET as a synonym for RETURN to make ppc64 consistent with the other architectures. However, that commit was never followed up to make the code itself consistent by eliminating uses of RETURN. This commit replaces all uses of RETURN in the ppc64 assembly with RET. This was done with sed -i 's/\<RETURN\>/RET/' **/*_ppc64x.s plus one manual change to syscall/asm.s. Change-Id: I3f6c8d2be157df8841d48de988ee43f3e3087995 Reviewed-on: https://go-review.googlesource.com/10672 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
2015-04-12sync/atomic: skip issue 7338 test on darwin/arm64David Crawshaw
Similar to darwin/arm. This issue is quite worrying and I hope it can be addressed for Go 1.5. Change-Id: Ic095281d6a2e9a38a59973f58d464471db5a2edc Reviewed-on: https://go-review.googlesource.com/8811 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-16sync/atomic: add support for GOARCH=arm64Aram Hăvărneanu
Change-Id: I11cd4b5e8daf3805af0eaa83b55b20da889702f4 Reviewed-on: https://go-review.googlesource.com/7145 Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-15sync/atomic: add support for openbsd/armJoel Sing
Change-Id: I45383de6d627be35f40e07a9008b6773f5c2b0d0 Reviewed-on: https://go-review.googlesource.com/7613 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-09sync/atomic: skip test on darwin/armDavid Crawshaw
Updates #7338. Change-Id: I859a73543352dbdd13ec05efb23a95aecbcc628a Reviewed-on: https://go-review.googlesource.com/7164 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-02-18[dev.cc] cmd/asm: make 4(SP) illegal except on 386Rob Pike
Require a name to be specified when referencing the pseudo-stack. If you want a real stack offset, use the hardware stack pointer (e.g., R13 on arm), not SP. Fix affected assembly files. Change-Id: If3545f187a43cdda4acc892000038ec25901132a Reviewed-on: https://go-review.googlesource.com/5120 Run-TryBot: Rob Pike <r@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-13[dev.cc] all: edit assembly source for ARM to be more regularRob Pike
Several .s files for ARM had several properties the new assembler will not support. These include: - mentioning SP or PC as a hardware register These are always pseudo-registers except that in some contexts they're not, and it's confusing because the context should not affect which register you mean. Change the references to the hardware registers to be explicit: R13 for SP, R15 for PC. - constant creation using assignment The files say a=b when they could instead say #define a b. There is no reason to have both mechanisms. - R(0) to refer to R0. Some macros use this to a great extent. Again, it's easy just to use a #define to rename a register. Change-Id: I002335ace8e876c5b63c71c2560533eb835346d2 Reviewed-on: https://go-review.googlesource.com/4822 Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-06sync/atomic: darwin/arm supportShenghou Ma
Change-Id: I213a8ab0b8c027a7b73567aeefdca73fd10eae28 Reviewed-on: https://go-review.googlesource.com/2122 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-06sync/atomic: remove atomic pointer hammer testsRuss Cox
These depend on storing arbitrary integer values using pointer atomics, and we can't support that anymore. Change-Id: I8cadd6d462c3eebdbe7078f43fe7c779fa8f52b3 Reviewed-on: https://go-review.googlesource.com/2311 Reviewed-by: Rick Hudson <rlh@golang.org>
2015-01-06runtime, sync/atomic: add write barrier for atomic write of pointerRuss Cox
Add write barrier to atomic operations manipulating pointers. In general an atomic write of a pointer word may indicate racy accesses, so there is no strictly safe way to attempt to keep the shadow copy in sync with the real one. Instead, mark the shadow copy as not used. Redirect sync/atomic pointer routines back to the runtime ones, so that there is only one copy of the write barrier and shadow logic. In time we might consider doing this for most of the sync/atomic functions, but for now only the pointer routines need that treatment. Found with GODEBUG=wbshadow=1 mode. Eventually that will run automatically, but right now it still detects other missing write barriers. Change-Id: I852936b9a111a6cb9079cfaf6bd78b43016c0242 Reviewed-on: https://go-review.googlesource.com/2066 Reviewed-by: Rick Hudson <rlh@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2014-12-05all: merge dev.garbage (d1238958d4ae) into default branchRuss Cox
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://golang.org/cl/183140043
2014-12-05all: power64 is now ppc64Russ Cox
Fixes #8654. LGTM=austin R=austin CC=golang-codereviews https://golang.org/cl/180600043
2014-11-14[dev.garbage] all: merge default (f38460037b72) into dev.garbageRuss Cox
This is the revision that dev.cc is branched from. LGTM=austin R=austin CC=golang-codereviews https://golang.org/cl/169590043
2014-11-03[dev.power64] all: merge default into dev.power64Austin Clements
Trivial merge except for src/runtime/asm_power64x.s and src/runtime/signal_power64x.c LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/168950044
2014-10-31sync/atomic: fix comment referencing Value.Store's argument nameBrad Fitzpatrick
Fixes #9029 LGTM=adg, r R=r, adg CC=golang-codereviews https://golang.org/cl/161630044
2014-10-30[dev.garbage] cmd/gc, runtime: implement write barriers in terms of ↵Russ Cox
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://golang.org/cl/168770043
2014-10-27[dev.power64] runtime: power64 fixes and ports of changesAustin Clements
Fix include paths that got moved in the great pkg/ rename. Add missing runtime/arch_* files for power64. Port changes that happened on default since branching to runtime/{asm,atomic,sys_linux}_power64x.s (precise stacks, calling convention change, various new and deleted functions. Port struct renaming and fix some bugs in runtime/defs_linux_power64.h. LGTM=rsc R=rsc, dave CC=golang-codereviews https://golang.org/cl/161450043
2014-10-22[dev.power64] all: merge default into dev.power64Austin Clements
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://golang.org/cl/152570049
2014-10-22build: merge the great pkg/ rename into dev.power64Austin Clements
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
2014-09-24runtime: more NOPTRRuss Cox
Fixes linux builds (_vdso); may fix others. I can at least cross-compile cmd/go for every implemented system now. TBR=iant CC=golang-codereviews https://golang.org/cl/142630043