summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* runtime: reconvert sigqueue.goc from C to GoRuss Cox2014-09-0414-266/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The original conversion in CL 132090043 cut up the function in an attempt to avoid converting most of the code to Go. This contorts the control flow. While debugging the onM signal stack bug, I reconverted sigqueue.goc in its entirety. This restores the original control flow, which is much easier to understand. The current conversion is correct, it's just complex and will be hard to maintain. The new one is as readable as the original code. I uploaded sigqueue.goc as the initial copy of sigqueue.go in the CL, so if you view the diffs of sigqueue.go comparing against patch set 2 [sic] it will show the actual starting point. For example: https://codereview.appspot.com/136160043/diff2/20001:60001/src/pkg/runtime/sigqueue.go LGTM=dvyukov, iant R=golang-codereviews, dvyukov, iant CC=golang-codereviews, khr, r https://codereview.appspot.com/136160043
* go/parser: initialize file set even in only some tests are runRobert Griesemer2014-09-041-2/+1
| | | | | | | | | Without this fix, some tests crashed (e.g. go test -run Invalid). LGTM=adonovan R=adonovan CC=golang-codereviews https://codereview.appspot.com/133580043
* androidtest.bash: drop noisy adb sync outputDavid Crawshaw2014-09-041-1/+3
| | | | | | | LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/138070043
* runtime: fix solaris netpollDmitriy Vyukov2014-09-041-1/+1
| | | | | | | TBR=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/141030043
* runtime: fix netbsd buildDmitriy Vyukov2014-09-043-3/+3
| | | | | | | TBR=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/140220043
* runtime: fix typosMikio Hara2014-09-041-3/+3
| | | | | | | LGTM=dvyukov R=dvyukov CC=golang-codereviews https://codereview.appspot.com/141000043
* runtime: fix Plan 9 buildDavid du Colombier2014-09-042-6/+4
| | | | | | | LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/138050043
* runtime: fix arm buildDmitriy Vyukov2014-09-041-1/+1
| | | | | | | TBR=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/140990043
* runtime: convert netpoll to GoDmitriy Vyukov2014-09-0431-773/+757
| | | | | | | | | | The common code is converted, epoll and kqueue are converted. Windows and solaris are still C. LGTM=rsc R=golang-codereviews, rsc, dave CC=golang-codereviews, iant, khr, rsc https://codereview.appspot.com/132910043
* runtime: fix nacl/amd64p32 buildRuss Cox2014-09-041-2/+2
| | | | | | | | BP is not a legal register on nacl. TBR=iant CC=golang-codereviews https://codereview.appspot.com/140980043
* runtime: fix int64 reconstruction in semasleepRuss Cox2014-09-041-1/+1
| | | | | | | | | | I had this right in one of my clients, but apparently not the one I submitted from. Fixes 386 builds. TBR=dfc CC=golang-codereviews https://codereview.appspot.com/138000045
* runtime: fix onM test for curg on armRuss Cox2014-09-041-1/+1
| | | | | | TBR=iant CC=golang-codereviews https://codereview.appspot.com/137130043
* runtime: fix sigtrampPC on WindowsRuss Cox2014-09-041-1/+1
| | | | | | | | | | | | | | | | | The arm5 build breakage at CL 139110043 was caused by calling funcPC on a lessstack defined as a struct{}. That symbol ended up with a non-4-aligned address, which caused the memory fault that broke the builders. The definition of lessstack was fixed in CL 140880043. Tracking that down suggested that it would be worth looking for the same bug elsewhere in the directory. This is the only one I found. LGTM=bradfitz R=golang-codereviews, dave, bradfitz CC=dvyukov, golang-codereviews, iant, khr, r https://codereview.appspot.com/134410043
* runtime: correct various Go -> C function callsRuss Cox2014-09-0421-152/+297
| | | | | | | | | | | | | | | | | | | Some things get converted. Other things (too complex or too many C deps) get onM calls. Other things (too simple) get #pragma textflag NOSPLIT. After this CL, the offending function list is basically: - panic.c - netpoll.goc - mem*.c - race stuff - readgstatus - entersyscall/exitsyscall LGTM=r, iant R=golang-codereviews, r, iant CC=dvyukov, golang-codereviews, khr https://codereview.appspot.com/140930043
* runtime: reject onM calls from gsignal stackRuss Cox2014-09-045-20/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation and use patterns of onM assume that they run on either the m->curg or m->g0 stack. Calling onM from m->gsignal has two problems: (1) When not on g0, onM switches to g0 and then "back" to curg. If we didn't start at curg, bad things happen. (2) The use of scalararg/ptrarg to pass C arguments and results assumes that there is only one onM call at a time. If a gsignal starts running, it may have interrupted the setup/teardown of the args for an onM on the curg or g0 stack. Using scalararg/ptrarg itself would smash those. We can fix (1) by remembering what g was running before the switch. We can fix (2) by requiring that uses of onM that might happen on a signal handling stack must save the old scalararg/ptrarg and restore them after the call, instead of zeroing them. The only sane way to do this is to introduce a separate onM_signalsafe that omits the signal check, and then if you see a call to onM_signalsafe you know the surrounding code must preserve the old scalararg/ptrarg values. (The implementation would be that onM_signalsafe just calls fn if on the signal stack or else jumps to onM. It's not necessary to have two whole copies of the function.) (2) is not a problem if the caller and callee are both Go and a closure is used instead of the scalararg/ptrarg slots. For now, I think we can avoid calling onM from code executing on gsignal stacks, so just reject it. In the long term, (2) goes away (as do the scalararg/ptrarg slots) once everything is in Go, and at that point fixing (1) would be trivial and maybe worth doing just for regularity. LGTM=iant R=golang-codereviews, iant CC=dvyukov, golang-codereviews, khr, r https://codereview.appspot.com/135400043
* runtime: refactor/fix asmcgocall/asmcgocall_errnoRuss Cox2014-09-043-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Instead of making asmcgocall call asmcgocall_errno, make both load args into registers and call a shared assembly function. On amd64, this costs 1 word in the asmcgocall_errno path but saves 3 words in the asmcgocall path, and the latter is what happens on critical nosplit paths on Windows. On arm, this fixes build failures: asmcgocall was writing the arguments for asmcgocall_errno into the wrong place on the stack. Passing them in registers avoids the decision entirely. On 386, this isn't really needed, since the nosplit paths have twice as many words to work with, but do it for consistency. Update issue 8635 Fixes arm build (except GOARM=5). TBR=iant CC=golang-codereviews https://codereview.appspot.com/134390043
* net: fix parsing literal IPv6 address with zone identifier in builtin dns ↵Mikio Hara2014-09-043-2/+5
| | | | | | | | | | | stub resolver Fixes issue 8619. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://codereview.appspot.com/132560043
* runtime: give 2 words back in notetsleep_internalRuss Cox2014-09-031-5/+11
| | | | | | | | | | I really hoped we could avoid this nonsense, but it appears not. Should fix windows/amd64 build breakage. TBR=iant CC=golang-codereviews https://codereview.appspot.com/137120043
* net: fix parsing literal IP address in builtin dns stub resolverMikio Hara2014-09-047-63/+83
| | | | | | | | | | | | | This CL fixes a bug introduced by CL 128820043 which is that builtin dns stub resolver doesn't work well with literal IPv6 address namesever entries in /etc/resolv.conf. Also simplifies resolv.conf parser and adds more test cases. LGTM=iant R=golang-codereviews, bradfitz, iant CC=golang-codereviews https://codereview.appspot.com/140040043
* text/template: 0xef is an integer, not a floating-point value.Rob Pike2014-09-033-1/+12
| | | | | | | | | | | | | The discriminator in the execution engine was stupid. Add a test to the parse package too. The problem wasn't there but the particular case ('e' in a hex integer) was not covered. Fixes issue 8622. LGTM=ruiu R=golang-codereviews, ruiu CC=golang-codereviews https://codereview.appspot.com/133530043
* runtime: make entersyscall/exitsyscall safe for stack splitsRuss Cox2014-09-033-59/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is fundamentally unsafe to grow the stack once someone has made a call to syscall.Syscall. That function takes 6 uintptr arguments, but depending on the call some are pointers. In fact, some might be pointers to stack values, and we don't know which. That makes it impossible to copy the stack somewhere else. Since we want to delete all the stack splitting code, relying only on stack copying, make sure that Syscall never needs to split the stack. The only thing Syscall does is: call entersyscall make the system call call exitsyscall As long as we make sure that entersyscall and exitsyscall can live in the nosplit region, they won't ask for more stack. Do this by making entersyscall and exitsyscall set up the stack guard so that any call to a function with a split check will cause a crash. Then move non-essential slow-path work onto the m stack using onM and mark the rest of the work nosplit. The linker will verify that the chain of nosplits fits in the total nosplit budget. LGTM=iant R=golang-codereviews, iant CC=dvyukov, golang-codereviews, khr, r https://codereview.appspot.com/140950043
* runtime: convert symtab.c into symtab.goRuss Cox2014-09-039-459/+275
| | | | | | | | | | | | | | | | | | Because symtab.c was partially converted before, the diffs are not terribly useful. The earlier conversion was trying to refactor or clean up the code in addition to doing the translation. It also made a mistake by redefining Func to be something users could overwrite. I undid those changes, making symtab.go a more literal line-for-line translation of symtab.c instead. LGTM=josharian R=golang-codereviews, dave, bradfitz, josharian CC=golang-codereviews, iant, khr, r https://codereview.appspot.com/140880043
* runtime: relax flaky GC pause testBrad Fitzpatrick2014-09-031-3/+6
| | | | | | | | | | | We often saw GC pauses of 0 ns, not just on Windows. Google Compute Engine timer granularity might suck too. LGTM=rsc R=rsc, dvyukov CC=golang-codereviews https://codereview.appspot.com/140910043
* runtime: remove guard against uninitialized forcegc.gRuss Cox2014-09-031-6/+3
| | | | | | | | | | | The race was in the old C code. The new Go code does not have the race and does not need the check. LGTM=bradfitz, dvyukov R=golang-codereviews, bradfitz, dvyukov CC=golang-codereviews, rlh https://codereview.appspot.com/140180043
* runtime: adopt race detector for runtime written in GoDmitriy Vyukov2014-09-033-10/+18
| | | | | | | | | | | Ignore memory access on g0/gsignal. See the issue for context and explanation. Fixes issue 8627. LGTM=khr R=golang-codereviews, mdempsky, khr CC=golang-codereviews, rsc https://codereview.appspot.com/137070043
* runtime: Start and stop individual goroutines at gc safepointsRick Hudson2014-09-034-10/+262
| | | | | | | | | | | | | | | | 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://codereview.appspot.com/131580043
* runtime: deferproc/deferreturn in GoKeith Randall2014-09-0313-217/+259
| | | | | | | LGTM=rsc R=golang-codereviews, rsc, khr CC=golang-codereviews https://codereview.appspot.com/139900043
* cmd/cgo, runtime: write cgo stub wrappers in Go, not CRuss Cox2014-09-038-98/+156
| | | | | | | LGTM=alex.brainman, iant R=golang-codereviews, alex.brainman, iant CC=dvyukov, golang-codereviews, khr, r https://codereview.appspot.com/139070043
* runtime: make onM and mcall take Go func valuesRuss Cox2014-09-0318-92/+141
| | | | | | | | | | 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://codereview.appspot.com/137970044
* runtime: convert a few traceback-related functions from proc.c to traceback.goRuss Cox2014-09-0333-167/+158
| | | | | | | | | | | | | | 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://codereview.appspot.com/139110043
* runtime: introduce, use funcPC to convert Go func to PCRuss Cox2014-09-039-72/+33
| | | | | | | | | | | 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://codereview.appspot.com/140870044
* runtime: increase windows prof thread priority soonerAlex Brainman2014-09-031-0/+1
| | | | | | | | | | | | | | | 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://codereview.appspot.com/134360043
* runtime: avoid race with forcegc helperRuss Cox2014-09-022-19/+24
| | | | | | | | | | 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://codereview.appspot.com/133470043
* runtime: don't allocate a new string in snprintfDavid du Colombier2014-09-031-1/+1
| | | | | | | | | | | This fixes the Plan 9 build. Fix issue 8621. LGTM=iant R=rsc, mattn.jp, iant CC=golang-codereviews https://codereview.appspot.com/135280043
* runtime: handle empty environment variables on Plan 9David du Colombier2014-09-031-0/+4
| | | | | | | LGTM=bradfitz, rsc R=rsc, bradfitz CC=golang-codereviews https://codereview.appspot.com/137920044
* runtime: unify fastrand1 and fastrand2Keith Randall2014-09-0210-26/+10
| | | | | | | | | | 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://codereview.appspot.com/139080043
* runtime: convert select implementation to Go.Keith Randall2014-09-0212-673/+677
| | | | | | | LGTM=rsc R=golang-codereviews, bradfitz, iant, khr, rsc CC=golang-codereviews https://codereview.appspot.com/139020043
* crypto: Add SHA3 functions in go.crypto/sha3 to the Hash enum.David Leon Gil2014-09-021-0/+8
| | | | | | | | | | | Reverse dependency of https://codereview.appspot.com/130950043/ LGTM=agl R=golang-codereviews, agl CC=agl, golang-codereviews https://codereview.appspot.com/138800043 Committer: Adam Langley <agl@golang.org>
* runtime: convert traceback*.c to GoRuss Cox2014-09-0214-838/+668
| | | | | | | | | | | | | 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://codereview.appspot.com/134200044
* cmd/gc: fix runtime print(hex(x))Russ Cox2014-09-021-1/+1
| | | | | | | | | | | | The code I wrote originally works for trivial functions that are inlined at a call site in another package, because that was how I wrote my local test. Make hex(x) work for non-inlinable functions too. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://codereview.appspot.com/140830043
* runtime: move reflect trampolines into thunk file.Keith Randall2014-09-025-116/+39
| | | | | | | LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/133460043
* database/sql: Avoid re-preparing statements when all connections are busyMarko Tiikkaja2014-09-022-30/+41
| | | | | | | | | | | | | | | | | | | Previously, if all connections were busy, we would always re-prepare the statement on the connection we were assigned from the pool. That meant that if all connections were busy most of the time, the number of prepared statements for each connection would keep increasing over time. Instead, after getting a free connection, check to see if the statement has already been prepared on it, and reuse the statement handle if so. LGTM=bradfitz R=golang-codereviews, gobot, bradfitz CC=golang-codereviews https://codereview.appspot.com/116930043 Committer: Brad Fitzpatrick <bradfitz@golang.org>
* runtime: convert clearpools/registerPoolCleanup to GoDmitriy Vyukov2014-09-024-34/+32
| | | | | | | LGTM=bradfitz, rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews, khr https://codereview.appspot.com/133240043
* runtime: convert cpuprof from C to GoMatthew Dempsky2014-09-025-464/+431
| | | | | | | | | LGTM=dvyukov, rsc R=golang-codereviews, dvyukov, rsc CC=golang-codereviews https://codereview.appspot.com/132440043 Committer: Russ Cox <rsc@golang.org>
* runtime/pprof: adjust cpuHogger so that tests pass on windows buildersAlex Brainman2014-09-011-4/+4
| | | | | | | | | LGTM=rsc R=dvyukov, rsc CC=golang-codereviews https://codereview.appspot.com/140110043 Committer: Russ Cox <rsc@golang.org>
* runtime: fix gogetenv on Plan 9David du Colombier2014-09-011-15/+5
| | | | | | | | | LGTM=rsc R=rsc, ality CC=golang-codereviews https://codereview.appspot.com/137030043 Committer: Russ Cox <rsc@golang.org>
* runtime: fix race detector running Go code on g0 of non-main threadRuss Cox2014-09-011-0/+2
| | | | | | | | | | | | | | | | | 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://codereview.appspot.com/137910043
* time: update generated zoneinfo_abbrs_windows.goAlex Brainman2014-09-021-4/+4
| | | | | | | | | | | The file in repo has been updated recently, but all these changes are gone off the web site now. It seems web site gets updated once in a while, so we'll update our file occasionally. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://codereview.appspot.com/140780043
* runtime: fix StackRuss Cox2014-09-012-2/+12
| | | | | | | | | Fixes issue 8626. LGTM=bradfitz R=golang-codereviews CC=bradfitz, golang-codereviews, iant, r https://codereview.appspot.com/137050043
* runtime: convert mprof.goc to mprof.goRuss Cox2014-09-0117-786/+412
| | | | | | | | | | | | | 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://codereview.appspot.com/137040043