aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
AgeCommit message (Collapse)Author
2014-08-24runtime: remove some overuse of uintptr/unsafe.PointerRuss Cox
Now 'go vet runtime' only shows: malloc.go:200: possible misuse of unsafe.Pointer malloc.go:214: possible misuse of unsafe.Pointer malloc.go:250: possible misuse of unsafe.Pointer stubs.go:167: possible misuse of unsafe.Pointer Those are all unavoidable. LGTM=josharian R=golang-codereviews, dvyukov, josharian CC=dave, golang-codereviews https://golang.org/cl/135730043
2014-08-24runtime: fix arm buildRuss Cox
TBR=dvyukov CC=golang-codereviews https://golang.org/cl/131150043
2014-08-24runtime: convert synchronous semaphores to GoDmitriy Vyukov
LGTM=rsc R=golang-codereviews, khr, rsc CC=golang-codereviews, rlh https://golang.org/cl/130340043
2014-08-24runtime: convert channel operations to Go, part 1 (chansend1).Keith Randall
LGTM=dvyukov R=dvyukov, khr CC=golang-codereviews https://golang.org/cl/127460044
2014-08-24runtime: fix races on mheap.allspansDmitriy Vyukov
This is based on the crash dump provided by Alan and on mental experiments: sweep 0 74 fatal error: gc: unswept span runtime stack: runtime.throw(0x9df60d) markroot(0xc208002000, 0x3) runtime.parfordo(0xc208002000) runtime.gchelper() I think that when we moved all stacks into heap, we introduced a bunch of bad data races. This was later worsened by parallel stack shrinking. Observation 1: exitsyscall can allocate a stack from heap at any time (including during STW). Observation 2: parallel stack shrinking can (surprisingly) grow heap during marking. Consider that we steadily grow stacks of a number of goroutines from 8K to 16K. And during GC they all can be shrunk back to 8K. Shrinking will allocate lots of 8K stacks, and we do not necessary have that many in heap at this moment. So shrinking can grow heap as well. Consequence: any access to mheap.allspans in GC (and otherwise) must take heap lock. This is not true in several places. Fix this by protecting accesses to mheap.allspans and introducing allspans cache for marking, similar to what we use for sweeping. LGTM=rsc R=golang-codereviews, rsc CC=adonovan, golang-codereviews, khr, rlh https://golang.org/cl/126510043
2014-08-24runtime: cache unrolled GC bitmaskDmitriy Vyukov
Cache unrolled GC bitmask for types up to 64/32K on 64/32-bit systems, this corresponds to up to 4K cached bitmask. Perf builders say that 2% of time is spent in unrollgcproginplace_m/unrollgcprog1 on http benchmark: http://goperfd.appspot.com/log/f42045f45bf61a0da53b724a7c8567824a0ad6c9 LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr, rlh https://golang.org/cl/122680043
2014-08-24runtime: convert sigqueue to GoDmitriy Vyukov
LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr https://golang.org/cl/132090043
2014-08-24runtime: convert parfor to GoDmitriy Vyukov
LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr https://golang.org/cl/132100043
2014-08-23runtime: adjust errorCString definition to avoid allocationRuss Cox
The low-level implementation of divide on ARM assumes that it can panic with an error created by newErrorCString without allocating. If we make interface data words require pointer values, the current definition would require an allocation when stored in an interface. Changing the definition to use unsafe.Pointer instead of uintptr avoids the allocation. This change is okay because the field really is a pointer (to a C string in rodata). Update #8405. This should make CL 133830043 safe to try again. LGTM=bradfitz R=golang-codereviews, bradfitz CC=dave, golang-codereviews, r https://golang.org/cl/133820043
2014-08-23runtime: convert float64toint64, float64touint64 to GoDave Cheney
This is a very dumb translation to keep the code as close to the original C as possible. LGTM=rsc R=khr, minux, rsc, josharian CC=golang-codereviews https://golang.org/cl/126490043
2014-08-23runtime: remove unused varDmitriy Vyukov
LGTM=bradfitz R=daniel.morsing, bradfitz CC=golang-codereviews https://golang.org/cl/130500044
2014-08-23runtime: run newproc1 on M stack.Daniel Morsing
This makes newproc invisible to the GC. This is a pretty simple change since parts of newproc already depends on being run on the M stack. LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews, khr https://golang.org/cl/129520043
2014-08-22runtime: fix futex notesDmitriy Vyukov
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/126540043
2014-08-22runtime: convert note to GoDmitriy Vyukov
Note is required for timers and heap scavenger. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr, rlh https://golang.org/cl/128620043
2014-08-22runtime: please vetDmitriy Vyukov
The current code is correct, but vet does not understand it: asm_amd64.s:963: [amd64] invalid MOVL of ret+0(FP); int64 is 8-byte value asm_amd64.s:964: [amd64] invalid offset ret+4(FP); expected ret+0(FP) LGTM=minux R=golang-codereviews, minux CC=golang-codereviews https://golang.org/cl/125200044
2014-08-22runtime: add Go symtab implementationJosh Bleecher Snyder
LGTM=khr R=khr, dvyukov, dave CC=golang-codereviews, rsc https://golang.org/cl/124300044
2014-08-21runtime: give an explicit name to profiling Bucket sub-structs.Rémy Oudompheng
Fixes compilation of runtime on Solaris where the inner struct was not called "_4_". LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/129460043
2014-08-21runtime: convert lfstack to GoDmitriy Vyukov
It is called from Go only in tests. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/125610043
2014-08-21runtime: remove now arg from timer callbackDmitriy Vyukov
Cleanup before converting to Go. Fortunately nobody using it, because it is incorrect: monotonic runtime time instead of claimed real time. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rsc https://golang.org/cl/129480043
2014-08-21runtime: convert common scheduler functions to GoDmitriy Vyukov
These are required for chans, semaphores, timers, etc. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/123640043
2014-08-21runtime: init GC laterDmitriy Vyukov
Init GC later as it needs to read GOGC env var. Fixes #8562. LGTM=daniel.morsing, rsc R=golang-codereviews, daniel.morsing, rsc CC=golang-codereviews, khr, rlh https://golang.org/cl/130990043
2014-08-21runtime: fix deadlock when gctraceDmitriy Vyukov
Calling ReadMemStats which does stoptheworld on m0 holding locks was not a good idea. Stoptheworld holding locks is a recipe for deadlocks (added check for this). Stoptheworld on g0 may or may not work (added check for this as well). As far as I understand scavenger will print incorrect numbers now, as stack usage is not subtracted from heap. But it's better than deadlocking. LGTM=khr R=golang-codereviews, rsc, khr CC=golang-codereviews, rlh https://golang.org/cl/124670043
2014-08-21runtime: convert MemProfile, BlockProfile, ThreadCreateProfile to Go.Rémy Oudompheng
LGTM=khr R=golang-codereviews, bradfitz, khr CC=golang-codereviews https://golang.org/cl/123680043
2014-08-20runtime: remove unused variableJosh Bleecher Snyder
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/128230047
2014-08-20runtime: convert memclrBytes to GoJosh Bleecher Snyder
LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/131980043
2014-08-20runtime: add atomicor8 for amd64p32Dmitriy Vyukov
LGTM=khr R=golang-codereviews, daniel.morsing, khr, rsc CC=golang-codereviews, khr, rlh https://golang.org/cl/131950043
2014-08-19runtime: fix typo in commentJosh Bleecher Snyder
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/125500043
2014-08-19runtime: fix TestGcLastTime on windowsDmitriy Vyukov
Intended to fix: http://build.golang.org/log/d6718ea67541b8c6be2bb14bcbc4e1c4261f67d7 LGTM=khr R=golang-codereviews, khr CC=golang-codereviews https://golang.org/cl/127520043
2014-08-19runtime: make the GC bitmap a byte arrayDmitriy Vyukov
Half the code in the garbage collector accesses the bitmap as an array of bytes instead of as an array of uintptrs. This is tricky to do correctly in a portable fashion, it breaks on big-endian systems. Make the bitmap a byte array. Simplifies markallocated, scanblock and span sweep along the way, as we don't need to recalculate bitmap position for each word. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/125250043
2014-08-19runtime: always pass type to mallocgc when allocating scannable memoryDmitriy Vyukov
We allocate scannable memory w/o type only in few places in runtime. All these cases are not-performance critical (e.g. G or finq args buffer), and in long term they all need to go away. It's not worth it to have special code for this case in mallocgc. So use special fake "notype" type for such allocations. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/127450044
2014-08-19runtime: allow copying of onM frameDmitriy Vyukov
Currently goroutines in onM can't be copied/shrunk (including the very goroutine that triggers GC). Special case onM to allow copying. LGTM=daniel.morsing, khr R=golang-codereviews, daniel.morsing, khr, rsc CC=golang-codereviews, rlh https://golang.org/cl/124550043
2014-08-19runtime: fix MemStats on 32-bitsDmitriy Vyukov
Int64's do not fit into uintptr's. LGTM=khr R=golang-codereviews, khr, rsc CC=golang-codereviews, rlh https://golang.org/cl/128380043
2014-08-19runtime: convert Gosched to GoDmitriy Vyukov
LGTM=rlh, khr R=golang-codereviews, rlh, bradfitz, khr CC=golang-codereviews, rsc https://golang.org/cl/127490043
2014-08-19runtime: improve diagnostics of non-copyable framesDmitriy Vyukov
LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/124560043
2014-08-19runtime: fix memstatsDmitriy Vyukov
Newly allocated memory is subtracted from inuse, while it was never added to inuse. Span leftovers are subtracted from both inuse and idle, while they were never added. Fixes #8544. Fixes #8430. LGTM=khr, cookieo9 R=golang-codereviews, khr, cookieo9 CC=golang-codereviews, rlh, rsc https://golang.org/cl/130200044
2014-08-19runtime: apply KindMask before comparisonAlex Brainman
Fixes windows build. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/127510043
2014-08-18runtime: fix windows/amd64 build after pc-relative 6l changeRuss Cox
TBR=iant CC=golang-codereviews https://golang.org/cl/131900043
2014-08-18cmd/gc, runtime: refactor interface inlining decision into compilerRuss Cox
We need to change the interface value representation for concurrent garbage collection, so that there is no ambiguity about whether the data word holds a pointer or scalar. This CL does NOT make any representation changes. Instead, it removes representation assumptions from various pieces of code throughout the tree. The isdirectiface function in cmd/gc/subr.c is now the only place that decides that policy. The policy propagates out from there in the reflect metadata, as a new flag in the internal kind value. A follow-up CL will change the representation by changing the isdirectiface function. If that CL causes problems, it will be easy to roll back. Update #8405. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://golang.org/cl/129090043
2014-08-18runtime: avoid $sym(SB) as constantRuss Cox
The change to pc-relative addressing will make this illegal. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://golang.org/cl/129890043
2014-08-18runtime: move panicindex/panicslice to Go.Keith Randall
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/130210043
2014-08-18runtime: add more cases to GC info testDmitriy Vyukov
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews, khr, rlh, rsc https://golang.org/cl/125420043
2014-08-18runtime: implement transfer cacheDmitriy Vyukov
Currently we do the following dance after sweeping a span: 1. lock mcentral 2. remove the span from a list 3. unlock mcentral 4. unmark span 5. lock mheap 6. insert the span into heap 7. unlock mheap 8. lock mcentral 9. observe empty list 10. unlock mcentral 11. lock mheap 12. grab the span 13. unlock mheap 14. mark span 15. lock mcentral 16. insert the span into empty list 17. unlock mcentral This change short-circuits this sequence to nothing, that is, we just cache and use the span after sweeping. This gives us functionality similar (even better) to tcmalloc's transfer cache. benchmark old ns/op new ns/op delta BenchmarkMalloc8 22.2 19.5 -12.16% BenchmarkMalloc16 31.0 26.6 -14.19% LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/119550043
2014-08-18runtime: fix dump of data/bssDmitriy Vyukov
Fixes #8530. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rsc https://golang.org/cl/124440043
2014-08-18runtime: don't acquirem on malloc fast pathDmitriy Vyukov
Mallocgc must be atomic wrt GC, but for performance reasons don't acquirem/releasem on fast path. The code does not have split stack checks, so it can't be preempted by GC. Functions like roundup/add are inlined. And onM/racemalloc are nosplit. Also add debug code that checks these assumptions. benchmark old ns/op new ns/op delta BenchmarkMalloc8 20.5 17.2 -16.10% BenchmarkMalloc16 29.5 27.0 -8.47% BenchmarkMallocTypeInfo8 31.5 27.6 -12.38% BenchmarkMallocTypeInfo16 34.7 30.9 -10.95% LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/123100043
2014-08-16runtime: mark with non-atomic operations when GOMAXPROCS=1Dmitriy Vyukov
Perf builders show 3-5% GC pause increase with GOMAXPROCS=1 when marking with atomic ops: http://goperfd.appspot.com/perfdetail?commit=a8a6e765d6a87f7ccb71fd85a60eb5a821151f85&commit0=3b864e02b987171e05e2e9d0840b85b5b6476386&kind=builder&builder=linux-amd64&benchmark=http LGTM=rlh R=golang-codereviews, rlh CC=dave, golang-codereviews, khr, rsc https://golang.org/cl/128340043
2014-08-15runtime: fix getgcmaskDmitriy Vyukov
bv.data is an array of uint32s but the code was using offsets computed for an array of bytes. Add a test for stack GC info. Fixes #8531. LGTM=rsc R=golang-codereviews CC=golang-codereviews, khr, rsc https://golang.org/cl/124450043
2014-08-14runtime: mark objects with non-atomic operationsDmitriy Vyukov
On the go.benchmarks/garbage benchmark with GOMAXPROCS=16: old ns/op new ns/op delta time 1392254 1353170 -2.81% cputime 21995751 21373999 -2.83% gc-pause-one 15044812 13050524 -13.26% gc-pause-total 213636 185317 -13.26% LGTM=rlh R=golang-codereviews, rlh CC=golang-codereviews, khr, rsc https://golang.org/cl/123380043
2014-08-13runtime: keep objects in free lists marked as allocated.Dmitriy Vyukov
Restore https://golang.org/cl/41040043 after GC rewrite. Original description: On the plus side, we don't need to change the bits on malloc and free. On the downside, we need to mark objects in the free lists during GC. But the free lists are small at GC time, so it should be a net win. benchmark old ns/op new ns/op delta BenchmarkMalloc8 21.9 20.4 -6.85% BenchmarkMalloc16 31.1 29.6 -4.82% LGTM=khr R=khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/122280043
2014-08-12runtime: avoid using address as constant in amd64 assemblyRuss Cox
This allows changing the addressing mode for constant global addresses to use pc-relative addressing. LGTM=rminnich, iant R=golang-codereviews, rminnich, iant CC=golang-codereviews https://golang.org/cl/129830043
2014-08-13runtime: remove FlagNoProfileDmitriy Vyukov
Turns out to be unused as well. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews, khr https://golang.org/cl/127170044