summaryrefslogtreecommitdiff
path: root/src/pkg
Commit message (Collapse)AuthorAgeFilesLines
* build: move package sources from src/pkg to srcRuss Cox2014-09-082097-511731/+0
| | | | | | Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
* build: adjustments for move from src/pkg to srcRuss Cox2014-09-0812-56/+45
| | | | | | | | | | | | | | | | | | | This CL adjusts code referring to src/pkg to refer to src. Immediately after submitting this CL, I will submit a change doing 'hg mv src/pkg/* src'. That change will be too large to review with Rietveld but will contain only the 'hg mv'. This CL will break the build. The followup 'hg mv' will fix it. For more about the move, see golang.org/s/go14nopkg. LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/134570043
* net/http: add Transport.DialTLS hookBrad Fitzpatrick2014-09-072-20/+83
| | | | | | | | | | | | Per discussions out of https://codereview.appspot.com/128930043/ and golang-nuts threads and with agl. Fixes Issue 8522 LGTM=agl, adg R=agl, c, adg CC=c, golang-codereviews https://codereview.appspot.com/137940043
* runtime: implement time.now in assembly on plan9, solaris, windowsRuss Cox2014-09-079-43/+95
| | | | | | | | | | | | | | | | | | | These all used a C implementation that contained 64-bit divide by 1000000000. On 32-bit systems that ends up in the 64-bit C divide support, which makes other calls and ends up using a fair amount of stack. We could convert them to Go but then they'd still end up in software 64-bit divide code. That would be okay, because Go code can split the stack, but it's still unnecessary. Write time?now in assembly, just like on all the other systems, and use the actual hardware support for 64/32 -> 64/32 division. This cuts the software routines out entirely. The actual code to do the division is copied and pasted from the sys_darwin_*.s files. LGTM=alex.brainman R=golang-codereviews, alex.brainman CC=aram, golang-codereviews, iant, khr, r https://codereview.appspot.com/136300043
* net/http/httptest: delete TestIssue7264Russ Cox2014-09-071-23/+0
| | | | | | | | | | | | | | | | | | Now it's failing on Windows: panic: httptest: failed to listen on a port: listen tcp 127.0.0.1:0: listen: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. Since we can't seem to understand what the test is trying to test, and because it is causing problems on multiple systems, delete it. Fixes issue 7264. TBR=bradfitz CC=brainman, golang-codereviews https://codereview.appspot.com/141210043
* runtime: fix semacquire->acquireSudog->malloc->gogc->semacquire loopRuss Cox2014-09-071-1/+13
| | | | | | | | | | This is what broke the build at http://build.golang.org/log/d9c6d334be16cbab85e99fddc6b4ba034319bd4e LGTM=iant R=golang-codereviews, iant CC=dvyukov, golang-codereviews, khr, r https://codereview.appspot.com/135580043
* net/http/httptest: fix deadlock in TestIssue7264Russ Cox2014-09-071-5/+5
| | | | | | | | | | | | | | | | | | | | I am seeing deadlocks waiting on <-inHandler. It seems to me that there is no guarantee that the handler actually runs, if the client does write header close connection fast enough. The server might see the EOF on the connection before it manages to invoke the handler. This change fixes the deadlock, but it may make the test not actually test anything. Not sure. LGTM=bradfitz R=bradfitz, dvyukov CC=golang-codereviews https://codereview.appspot.com/140970043
* runtime: save g to TLS more aggressivelyRuss Cox2014-09-073-25/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is one of those "how did this ever work?" bugs. The current build failures are happening because a fault comes up while executing on m->curg on a system-created thread using an m obtained from needm, but TLS is set to m->g0, not m->curg. On fault, sigtramp starts executing, assumes r10 (g) might be incorrect, reloads it from TLS, and gets m->g0, not m->curg. Then sighandler dutifully pushes a call to sigpanic onto the stack and returns to it. We're now executing on the m->curg stack but with g=m->g0. Sigpanic does a stack split check, sees that the SP is not in range (50% chance depending on relative ordering of m->g0's and m->curg's stacks), and then calls morestack. Morestack sees that g=m->g0 and crashes the program. The fix is to replace every change of g in asm_arm.s with a call to a function that both updates g and saves the updated g to TLS. Why did it start happening? That's unclear. Unfortunately there were other bugs in the initial checkin that mask exactly which of a sequence of CLs started the behavior where sigpanic would end up tripping the stack split. Fixes arm build. Fixes issue 8675. LGTM=iant R=golang-codereviews, iant CC=dave, golang-codereviews, khr, minux, r https://codereview.appspot.com/135570043
* crypto/tls: print unexpected error in testRuss Cox2014-09-071-1/+1
| | | | | | | | Maybe will help us understand Solaris build failure. TBR=aram CC=golang-codereviews https://codereview.appspot.com/139290043
* runtime: fix nacl/amd64p32 buildRuss Cox2014-09-071-13/+3
| | | | | | | | | Update issue 8675 Fixes nacl/amd64p32 build. TBR=khr CC=golang-codereviews https://codereview.appspot.com/141140045
* runtime: fix windows syscalls for copying stacksRuss Cox2014-09-064-138/+184
| | | | | | | | | | | | Syscall and everything it calls must be nosplit: we cannot split a stack once Syscall has been invoked, because we don't know which of its arguments are pointers. LGTM=khr, r, alex.brainman R=dvyukov, iant, khr, r, bradfitz, alex.brainman CC=golang-codereviews https://codereview.appspot.com/133670043
* runtime: eliminate Go -> C -> block paths for SolarisRuss Cox2014-09-063-5/+33
| | | | | | | LGTM=aram, r R=golang-codereviews, aram, r CC=golang-codereviews, iant, khr https://codereview.appspot.com/141180043
* runtime: increase stack split limit againRuss Cox2014-09-062-94/+2
| | | | | | | | | | | | | | | | | | | | | Increase NOSPLIT reservation from 192 to 384 bytes. The problem is that the non-Unix systems (Solaris and Windows) just can't make system calls in a small amount of space, and then worse they do things that are complex enough to warrant calling runtime.throw on failure. We don't have time to rewrite the code to use less stack. I'm not happy about this, but it's still a small amount. The good news is that we're doing this to get to only using copying stacks for stack growth. Once that is true, we can drop the default stack size from 8k to 4k, which should more than make up for the bytes we're losing here. LGTM=r R=iant, r, bradfitz, aram.h CC=golang-codereviews https://codereview.appspot.com/140350043
* runtime/cgo: use just #include "textflag.h"Russ Cox2014-09-065-5/+5
| | | | | | | | | This will withstand the src/pkg/ to src/ move. LGTM=r R=iant, r CC=golang-codereviews https://codereview.appspot.com/134530044
* runtime: move stubs.goc code into runtime.cRuss Cox2014-09-062-57/+48
| | | | | | | | | | Now that the calling conventions are the same, there's no danger to using plain C for these. LGTM=bradfitz R=golang-codereviews, bradfitz CC=dvyukov, golang-codereviews, iant, khr, r https://codereview.appspot.com/134580043
* runtime, syscall: rewrite syscall_solaris.goc in GoAram H?v?rneanu2014-09-066-376/+509
| | | | | | | LGTM=dave, rsc R=khr, dvyukov, dave, gobot, rsc CC=golang-codereviews, rsc https://codereview.appspot.com/133220044
* runtime: fix panic/wrapper/recover mathRuss Cox2014-09-0613-104/+54
| | | | | | | | | | | | | | | | | | The gp->panicwrap adjustment is just fatally flawed. Now that there is a Panic.argp field, update that instead. That can be done on entry only, so that unwinding doesn't need to worry about undoing anything. The wrappers emit a few more instructions in the prologue but everything else in the system gets much simpler. It also fixes (without trying) a broken test I never checked in. Fixes issue 7491. LGTM=khr R=khr CC=dvyukov, golang-codereviews, iant, r https://codereview.appspot.com/135490044
* runtime: badreflectcall runs on the G stack - convert to Go.Keith Randall2014-09-062-6/+4
| | | | | | | LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://codereview.appspot.com/136260043
* runtime: get rid of other Go->C calls in test exports.Keith Randall2014-09-065-30/+33
| | | | | | | | | | testSchedLocal* tests need to malloc now because their stack frames are too big to fit on the G0 stack. LGTM=iant R=golang-codereviews, iant, khr CC=golang-codereviews https://codereview.appspot.com/133660043
* runtime: move gostringw and gogobytes test stubs to Go.Keith Randall2014-09-052-16/+14
| | | | | | | LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/141150043
* runtime: run getgcmask on the M stack.Keith Randall2014-09-053-10/+14
| | | | | | | LGTM=rsc R=rsc, khr CC=golang-codereviews https://codereview.appspot.com/132660043
* runtime: disable StackCopyAlwaysRuss Cox2014-09-051-1/+1
| | | | | | | | I forgot to clear this before submitting. TBR=khr CC=golang-codereviews https://codereview.appspot.com/132640044
* runtime: use reflect.call during panic instead of newstackcallRuss Cox2014-09-0512-280/+177
| | | | | | | | | | newstackcall creates a new stack segment, and we want to be able to throw away all that code. LGTM=khr R=khr, iant CC=dvyukov, golang-codereviews, r https://codereview.appspot.com/139270043
* runtime: handle nil ptr load/store in arm software floating pointRuss Cox2014-09-052-15/+66
| | | | | | | | | | | | | | | | | We cannot let a real panic start there, because there is C code on the stack, and worse, there is an assembly frame with a saved copy of the registers and we have no idea which ones are pointers. Instead, detect the nil ptr load/store and return out of the C and assembly into a stub that will start the call to sigpanic. Fixes GOARM=5 build. LGTM=iant R=golang-codereviews, iant CC=dave, golang-codereviews, minux, r https://codereview.appspot.com/138130043
* runtime: clean up sigqueue.goRuss Cox2014-09-051-59/+53
| | | | | | | | | | Minor changes to make logic clearer. Observed while working on the conversion. LGTM=iant, dvyukov R=dvyukov, iant CC=golang-codereviews https://codereview.appspot.com/140250043
* net: temporarily skip TestAcceptIgnoreSomeErrorsAlex Brainman2014-09-051-0/+2
| | | | | | | | | | | Update issue 8662 LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/138120043 Committer: Brad Fitzpatrick <bradfitz@golang.org>
* runtime: convert panic/recover to GoKeith Randall2014-09-057-207/+242
| | | | | | | | | | | | | created panic1.go just so diffs were available. After this CL is in, I'd like to move panic.go -> defer.go and panic1.go -> panic.go. LGTM=rsc R=rsc, khr CC=golang-codereviews https://codereview.appspot.com/133530045 Committer: Russ Cox <rsc@golang.org>
* runtime: use cas loop to coordinate with sigprofRuss Cox2014-09-041-5/+9
| | | | | | | | | | | | | | | | | | | | | | | sigprof and setcpuprofilerate coordinate the enabling/disabling of the handler using a Mutex. This has always been a bit dodgy: setcpuprofilerate must be careful to turn off signals before acquiring the lock to avoid a deadlock. Now the lock implementations use onM, and onM isn't okay on the signal stack. We know how to make it okay, but it's more work than is probably worth doing. Since this is super-dodgy anyway, replace the lock with a simple cas loop. It is only contended if setcpuprofilerate is being called, and that doesn't happen frequently enough to care about the raw speed or about using futexes/semaphores. TBR to fix freebsd/amd64 and dragonfly/amd64 builds. Happy to make changes in a follow-up CL. TBR=dvyukov CC=golang-codereviews https://codereview.appspot.com/141080044
* syscall: in linux/arm Syscall, zero R3, R4, R5Russ Cox2014-09-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The general kernel system call interface takes 6 arguments: R0, R1, R2, R3, R4, R5. Syscall is for calls that only need 3. The amd64 and 386 versions zero the extra arg registers, but the arm version does not. func utimensat calls Syscall with 3 arguments. The kernel expects a 4th argument. That turns out to be whatever is in R3 at the time of the call. CL 137160043 changed various pieces of code and apparently changed the value left in R3 at the time of utimensat's Syscall. This causes the kernel to return EINVAL. Change linux/arm Syscall to zero R3, R4, R5, so that calls will behave deterministically, even if they pass too few arguments. Arguably, utimensat could be fixed too, but the predictable zeroing is certainly worth doing, and once done utimensat's use of Syscall is fine. Fixes arm build. TBR=bradfitz CC=golang-codereviews https://codereview.appspot.com/141080043
* runtime: use new #include "textflag.h"Russ Cox2014-09-04106-106/+106
| | | | | | | | | | I did this just to clean things up, but it will be important when we drop the pkg directory later. LGTM=bradfitz R=r, bradfitz CC=golang-codereviews https://codereview.appspot.com/132600043
* runtime: do not stop traceback at onMRuss Cox2014-09-044-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Behavior before this CL: 1. If onM is called on a g0 stack, it just calls the given function. 2. If onM is called on a gsignal stack, it calls badonm. 3. If onM is called on a curg stack, it switches to the g0 stack and then calls the function. In cases 1 and 2, if the program then crashes (and badonm always does), we want to see what called onM, but the traceback stops at onM. In case 3, the traceback must stop at onM, because the g0 stack we are renting really does stop at onM. The current code stops the traceback at onM to handle 3, at the cost of making 1 and 2 crash with incomplete traces. Change traceback to scan past onM but in case 3 make it look like on the rented g0 stack, onM was called from mstart. The traceback already knows that mstart is a top-of-stack function. Alternate fix at CL 132610043 but I think this one is cleaner. This CL makes 3 the exception, while that CL makes 1 and 2 the exception. Submitting TBR to try to get better stack traces out of the freebsd/amd64 builder, but happy to make changes in a followup CL. TBR=khr R=khr CC=golang-codereviews https://codereview.appspot.com/133620043
* runtime: mark sysAlloc nosplitRuss Cox2014-09-0410-4/+46
| | | | | | | | | sysAlloc is the only mem function called from Go. LGTM=iant, khr R=golang-codereviews, khr, 0intro, iant CC=dvyukov, golang-codereviews, r https://codereview.appspot.com/139210043
* runtime: more C to Go conversion adjustmentsRuss Cox2014-09-0415-280/+477
| | | | | | | | | | | | | | | | Mostly NOSPLIT additions. Had to rewrite atomic_arm.c in Go because it calls lock, and lock is too complex. With this CL, I find no Go -> C calls that can split the stack on any system except Solaris and Windows. Solaris and Windows need more work and will be done separately. LGTM=iant, dave R=golang-codereviews, bradfitz, iant, dave CC=dvyukov, golang-codereviews, khr, r https://codereview.appspot.com/137160043
* go/parser: fix "zero day" parse errorRobert Griesemer2014-09-042-9/+11
| | | | | | | | | | | (a b string, ok bool) is not a valid signature Fixes issue 8656. LGTM=adonovan R=adonovan CC=golang-codereviews https://codereview.appspot.com/137140043
* runtime: make more functions safe for GoRuss Cox2014-09-0419-220/+274
| | | | | | | | | | | | | Convert no-op race functions. Everything else is tiny and gets NOSPLITs. After this, all that is left on darwin is sysAlloc, panic, and gothrow (all pending). There may be system-specific calls in other builds. LGTM=iant R=golang-codereviews, iant CC=dvyukov, golang-codereviews, khr, r https://codereview.appspot.com/140240044
* runtime: convert cgocall to GoDmitriy Vyukov2014-09-043-182/+150
| | | | | | | | | LGTM=khr, rsc R=golang-codereviews, khr, rsc CC=golang-codereviews https://codereview.appspot.com/131670043 Committer: Russ Cox <rsc@golang.org>
* runtime: use C for readgstatus, goroutine status valuesRuss Cox2014-09-042-28/+3
| | | | | | | | | | When this code was written, there was no way for Go to reuse the C function and enum values. Now there is. LGTM=bradfitz R=rlh, bradfitz CC=dvyukov, golang-codereviews, iant, khr, r https://codereview.appspot.com/139150045
* runtime: reconvert sigqueue.goc from C to GoRuss Cox2014-09-0413-266/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-0430-773/+754
| | | | | | | | | | 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