aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
AgeCommit message (Collapse)Author
2014-09-03runtime: Start and stop individual goroutines at gc safepointsRick Hudson
Code to bring goroutines to a gc safepoint one at a time, do some work such as scanning, and restart the goroutine, and then move on to the next goroutine. Currently this code does not do much useful work but this infrastructure will be critical to future concurrent GC work. Fixed comments reviewers. LGTM=rsc R=golang-codereviews, rsc, dvyukov CC=golang-codereviews https://golang.org/cl/131580043
2014-09-03runtime: deferproc/deferreturn in GoKeith Randall
LGTM=rsc R=golang-codereviews, rsc, khr CC=golang-codereviews https://golang.org/cl/139900043
2014-09-03cmd/cgo, runtime: write cgo stub wrappers in Go, not CRuss Cox
LGTM=alex.brainman, iant R=golang-codereviews, alex.brainman, iant CC=dvyukov, golang-codereviews, khr, r https://golang.org/cl/139070043
2014-09-03runtime: make onM and mcall take Go func valuesRuss Cox
This gives them correct types in Go and also makes it possible to use them to run Go code on an m stack. LGTM=iant R=golang-codereviews, dave, iant CC=dvyukov, golang-codereviews, khr, r https://golang.org/cl/137970044
2014-09-03runtime: convert a few traceback-related functions from proc.c to traceback.goRuss Cox
They were in proc.c mainly because there was no portable traceback source file. As part of converting them to Go, move to traceback.go. In order to get access to the PC of _rt0_go, rename to runtime.rt0_go. LGTM=r R=golang-codereviews, r CC=dvyukov, golang-codereviews, iant, khr https://golang.org/cl/139110043
2014-09-03runtime: introduce, use funcPC to convert Go func to PCRuss Cox
This removes the ** unsafe hack. Real bug fixed at chan.go:101. LGTM=dave, r, iant R=golang-codereviews, dave, r, iant CC=dvyukov, golang-codereviews, khr https://golang.org/cl/140870044
2014-09-03runtime: increase windows prof thread priority soonerAlex Brainman
If system is busy burning cpu, it takes long time (about 300ms on windows builders) to adjust prof thread priority. Once adjusted, prof thread runs ahead of everyone else, but due to initial slowness, it does not capture prof snapshots until start-up period is completed. Change prof thread priority sooner, so it can start captures straight away. LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews https://golang.org/cl/134360043
2014-09-02runtime: avoid race with forcegc helperRuss Cox
While we are here, give the gc helper a real function name that will appear in stack traces. LGTM=rlh R=rlh CC=dvyukov, golang-codereviews https://golang.org/cl/133470043
2014-09-03runtime: don't allocate a new string in snprintfDavid du Colombier
This fixes the Plan 9 build. Fix issue 8621. LGTM=iant R=rsc, mattn.jp, iant CC=golang-codereviews https://golang.org/cl/135280043
2014-09-03runtime: handle empty environment variables on Plan 9David du Colombier
LGTM=bradfitz, rsc R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/137920044
2014-09-02runtime: unify fastrand1 and fastrand2Keith Randall
C and Go calling conventions are now compatible, so we don't need two versions of this function. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/139080043
2014-09-02runtime: convert select implementation to Go.Keith Randall
LGTM=rsc R=golang-codereviews, bradfitz, iant, khr, rsc CC=golang-codereviews https://golang.org/cl/139020043
2014-09-02runtime: convert traceback*.c to GoRuss Cox
The two converted files were nearly identical. Instead of continuing that duplication, I merged them into a single traceback.go. Tested on arm, amd64, amd64p32, and 386. LGTM=r R=golang-codereviews, remyoudompheng, dave, r CC=dvyukov, golang-codereviews, iant, khr https://golang.org/cl/134200044
2014-09-02runtime: move reflect trampolines into thunk file.Keith Randall
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/133460043
2014-09-02runtime: convert clearpools/registerPoolCleanup to GoDmitriy Vyukov
LGTM=bradfitz, rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews, khr https://golang.org/cl/133240043
2014-09-02runtime: convert cpuprof from C to GoMatthew Dempsky
LGTM=dvyukov, rsc R=golang-codereviews, dvyukov, rsc CC=golang-codereviews https://golang.org/cl/132440043
2014-09-01runtime/pprof: adjust cpuHogger so that tests pass on windows buildersAlex Brainman
LGTM=rsc R=dvyukov, rsc CC=golang-codereviews https://golang.org/cl/140110043
2014-09-01runtime: fix gogetenv on Plan 9David du Colombier
LGTM=rsc R=rsc, ality CC=golang-codereviews https://golang.org/cl/137030043
2014-09-01runtime: fix race detector running Go code on g0 of non-main threadRuss Cox
It looks like this has just always been broken: the race detector handles running Go code on g0 of the main thread and on g0 of any extra threads created by non-Go code, but it does not handle running Go code on g0 of non-main threads created by Go. Handle that. Should fix the race build failures on the dashboard. We're running into this now because we are running more and more Go code on g0. TBR=dvyukov CC=golang-codereviews https://golang.org/cl/137910043
2014-09-01runtime: fix StackRuss Cox
Fixes #8626. LGTM=bradfitz R=golang-codereviews CC=bradfitz, golang-codereviews, iant, r https://golang.org/cl/137050043
2014-09-01runtime: convert mprof.goc to mprof.goRuss Cox
The exported Go definitions appearing in mprof.go are copied verbatim from debug.go. The unexported Go funcs and types are new. The C Bucket type used a union and was not a line-for-line translation. LGTM=remyoudompheng R=golang-codereviews, remyoudompheng CC=dvyukov, golang-codereviews, iant, khr, r https://golang.org/cl/137040043
2014-09-01runtime: fix windows buildRuss Cox
#ifdef'ed out code wasn't updated for argp change. TBR=iant CC=golang-codereviews https://golang.org/cl/139040043
2014-09-01runtime: change concatstring panic to gothrowRuss Cox
It was a throw originally; it was converted incorrectly. LGTM=dave R=khr, dave CC=golang-codereviews https://golang.org/cl/139000043
2014-09-01runtime: include os_*.h in the generated Go structsRuss Cox
Adding the #include to defs.c makes it get processed by cmd/dist, which writes out Go equivalent for all the C data structures defined in defs.c. This in turn makes it necessary to define the Plink type, used in os_plan9.h, in os_plan9.go. Rename it to _Plink to avoid being exported. LGTM=0intro, iant R=golang-codereviews, iant, 0intro CC=golang-codereviews, r https://golang.org/cl/132490043
2014-09-01runtime: change PC, SP values in Stkframe, Panic, Defer from byte* to uintptrRuss Cox
uintptr is better when translating to Go, and in a few places it's better in C too. LGTM=r R=golang-codereviews, r CC=golang-codereviews, iant, khr https://golang.org/cl/138980043
2014-09-01runtime/race: better handling of atomic operationsDmitriy Vyukov
This change fixes the last known false negative of the race detector -- detection of races between mutating atomic operations and non-atomic operations. Race runtime already has functions for precise modelling of various atomic operations, so this change just forwards all atomic ops to race runtime instead of poor man modeling in sync/atomic package. Performance is also improved -- full sync/atomic tests run in 60s instead of 85s now. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rsc https://golang.org/cl/111310044
2014-09-01runtime: remove old malloc test programsRuss Cox
These haven't been run in ages. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews, iant, khr, r https://golang.org/cl/134170043
2014-09-01runtime: paste mprof.goc into mprof.go as commentsRuss Cox
NO CODE CHANGES HERE The first conversion was not complete. This CL doesn't make any actual changes, but it inserts the missing mprof.goc code as comments so that the next CL will have useful diffs. To make the diffs a bit more useful, removed all semicolons, ->, and runtime· prefixes as well. Also corrected order of a few functions in mprof.go to match original order in mprof.goc. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews, iant, khr, r https://golang.org/cl/134200043
2014-08-30runtime: fix Linux buildIan Lance Taylor
Make the definition of the EpollEvent data field consistent across architectures, adapt the other use of it in netpoll_epoll for the new definition, and use uint64 rather than uintptr. LGTM=dave R=rsc, dave CC=golang-codereviews https://golang.org/cl/137890043
2014-08-30cmd/cc: generate error if #pragma pack off does anythingRuss Cox
We can't translate misaligned things to Go, so start rejecting them in C. The only one in any build appears to be EpollEvent on linux/amd64. Fix that. LGTM=r R=golang-codereviews, r, dvyukov CC=golang-codereviews, iant https://golang.org/cl/137020043
2014-08-30runtime: translate env*.c to GoRuss Cox
In an earlier CL I wrote a separate Go-only version, but that broke Plan 9, because the Go-only version assumed a non-Plan 9 system. Translate the real ones instead. LGTM=r R=golang-codereviews, r CC=0intro, golang-codereviews, iant, khr https://golang.org/cl/140050044
2014-08-30runtime/pprof: make CPU profiling tests more robustDmitriy Vyukov
Under the race detector most of the samples go into race runtime, because of that freebsd race builder constantly fails on this test. LGTM=bradfitz, rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews, minux https://golang.org/cl/133370043
2014-08-30runtime: preallocate panic errors for index and sliceRuss Cox
This avoids allocating at the panic sites. LGTM=r, khr R=golang-codereviews, r, khr CC=dvyukov, golang-codereviews, iant, khr https://golang.org/cl/136020043
2014-08-30runtime: convert chanrecv to GoKeith Randall
LGTM=rsc, dvyukov R=golang-codereviews, bradfitz, rsc, dvyukov CC=golang-codereviews https://golang.org/cl/136980044
2014-08-29runtime: retry fix openbsd buildMatthew Dempsky
Tested on linux/amd64 too this time. LGTM=bradfitz R=golang-codereviews, bradfitz CC=dave, golang-codereviews, iant, rsc https://golang.org/cl/140050043
2014-08-30runtime: increase nosplit area to 192Russ Cox
In CL 131450043, which raised it to 160, I'd raise it to 192 if necessary. Apparently it is necessary on windows/amd64. One note for those concerned about the growth: in the old segmented stack world, we wasted this much space at the bottom of every stack segment. In the new contiguous stack world, each goroutine has only one stack segment, so we only waste this much space once per goroutine. So even raising the limit further might still be a net savings. Fixes windows/amd64 build. TBR=r CC=golang-codereviews https://golang.org/cl/132480043
2014-08-30runtime: rename SysAlloc to sysAlloc for GoRuss Cox
Renaming the C SysAlloc will let Go define a prototype without exporting it. For use in cpuprof.goc's translation to Go. LGTM=mdempsky R=golang-codereviews, mdempsky CC=golang-codereviews, iant https://golang.org/cl/140060043
2014-08-30runtime: convert type algorithms to GoDmitriy Vyukov
Actually it mostly deletes code -- alg.print and alg.copy go away. There was only one usage of alg.print for debug purposes. Alg.copy is used in chan.goc, but Keith replaces them with memcopy during conversion, so alg.copy is not needed as well. Converting them would be significant amount of work for no visible benefit. LGTM=crawshaw, rsc, khr R=golang-codereviews, crawshaw, khr CC=golang-codereviews, rsc https://golang.org/cl/139930044
2014-08-30undo CL 135230043 / 60812bad3769Russ Cox
broke api check everywhere ««« original CL description runtime: fix openbsd build LGTM=iant R=iant, minux CC=golang-codereviews, jsing https://golang.org/cl/135230043 »»» TBR=mdempsky CC=golang-codereviews https://golang.org/cl/137010043
2014-08-29runtime: fix openbsd buildMatthew Dempsky
LGTM=iant R=iant, minux CC=golang-codereviews, jsing https://golang.org/cl/135230043
2014-08-29runtime: rename Sigaltstack to SigaltstackTIan Lance Taylor
Avoids a conflict between the type and function sigaltstack. LGTM=crawshaw R=rsc, crawshaw CC=golang-codereviews https://golang.org/cl/138920043
2014-08-29runtime: make allp a static arrayRuss Cox
It is anyway, just an allocated one. Giving it a sized type makes Go access nicer. LGTM=iant R=dvyukov, iant CC=golang-codereviews https://golang.org/cl/139960043
2014-08-29runtime: convert lock*.c to GoRuss Cox
LGTM=r, iant R=golang-codereviews, r, iant CC=dvyukov, golang-codereviews, khr https://golang.org/cl/139930043
2014-08-29runtime: include constants and defs_*_*.h types in generated Go defsRuss Cox
I had to rename Kevent and Sigaction to avoid the functions of the same (lowercase) name. LGTM=iant, r R=golang-codereviews, r, iant, aram.h CC=dvyukov, golang-codereviews, khr https://golang.org/cl/140740043
2014-08-29runtime: run runtime.initRuss Cox
Run it right before main.init. There is still some runtime initialization that happens before runtime.init, and some of that may call into Go code (for example to acquire locks) so this timing is not perfect, but I believe it is the best we can do. This came up because global variables intialized to func values are done in the generated init code, not in the linker. LGTM=dvyukov R=dvyukov CC=golang-codereviews, iant, khr, r https://golang.org/cl/135210043
2014-08-29cmd/gc: allow runtime to define a hex integer type for printingRuss Cox
As part of the translation of the runtime, we need to rewrite C printf calls to Go print calls. Consider this C printf: runtime·printf("[signal %x code=%p addr=%p pc=%p]\n", g->sig, g->sigcode0, g->sigcode1, g->sigpc); Today the only way to write that in Go is: print("[signal ") printhex(uint64(g->sig)) print(" code=") printhex(uint64(g->sigcode0)) print(" addr=") printhex(uint64(g->sigcode1)) print(" pc=") printhex(uint64(g->sigpc)) print("]\n") (That's nearly exactly what runtime code looked like in C before I added runtime·printf.) This CL recognizes the unexported type runtime.hex as an integer that should be printed in hexadecimal instead of decimal. It's a little kludgy, but it's restricted to package runtime. Other packages can define type hex with no effect at all. Now we can translate that original printf as the more compact: print("[signal ", hex(g->sig), " code=", hex(g->sigcode0), " addr=", hex(g->sigcode1), " pc=", hex(g->sigpc), "]\n") LGTM=r, iant R=r, iant CC=golang-codereviews https://golang.org/cl/133220043
2014-08-29runtime: implement 64 bit division in GoJosh Bleecher Snyder
LGTM=rsc, dave R=minux, rsc, remyoudompheng, dave CC=golang-codereviews https://golang.org/cl/133790043
2014-08-29runtime: clean up GC codeDmitriy Vyukov
Remove C version of GC. Convert freeOSMemory to Go. Restore g0 check in GC. Remove unknownGCPercent check in GC, it's initialized explicitly now. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr https://golang.org/cl/139910043
2014-08-29runtime: fix sprintf index out of boundsRuss Cox
Breaks on Plan 9, apparently. The other systems must not run sprintf during all.bash. I'd write a test but it's all going away. TBR=r CC=0intro, golang-codereviews https://golang.org/cl/133260044
2014-08-29runtime: allow sysvicall functions to be called from GoAram Hăvărneanu
Convert them to Go in the process. LGTM=dvyukov, dave R=khr, dvyukov, rsc, dave CC=golang-codereviews https://golang.org/cl/131600043