aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
AgeCommit message (Collapse)Author
2014-08-29runtime: allow to call stdcall from Go on windowsDmitriy Vyukov
I've started with just one function with 8 arguments, but stdcall is called from nosplit functions and 8 args overflow nosplit area. LGTM=aram, alex.brainman R=golang-codereviews, aram, alex.brainman, dave CC=golang-codereviews, iant, khr, rsc https://golang.org/cl/135090043
2014-08-29runtime: convert forcegc helper to GoDmitriy Vyukov
Also fix a bunch of bugs: 1. Accesses to last_gc must be atomic (it's int64). 2. last_gc still can be 0 during first checks in sysmon, check for 0. 3. forcegc.g can be unitialized when sysmon accesses it: forcegc.g is initialized by main goroutine (forcegc.g = newproc1(...)), and main goroutine is unsynchronized with both sysmon and forcegc goroutine. Initialize forcegc.g in the forcegc goroutine itself instead. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rsc https://golang.org/cl/136770043
2014-08-28runtime: don't allocate a new string in printfKeith Randall
LGTM=dave R=rsc, dave CC=golang-codereviews https://golang.org/cl/139890043
2014-08-28runtime: convert closechan/chanlen/chancap to GoKeith Randall
LGTM=bradfitz, rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews https://golang.org/cl/135150043
2014-08-28runtime: convert print.c to GoRuss Cox
LGTM=iant R=golang-codereviews, iant CC=dvyukov, golang-codereviews, khr, r https://golang.org/cl/135930043
2014-08-28runtime: remove holes in FUNCDATA tablesMatthew Dempsky
Shrinks the text segment size by about 1.5% for the "go", "gofmt", and "camlistored" commands on linux/amd64. Before: $ size go gofmt camlistored text data bss dec hex filename 6506842 136996 105784 6749622 66fdb6 go 2376046 85232 90984 2552262 26f1c6 gofmt 17051050 190256 130320 17371626 10911ea camlistored After: $ size go gofmt camlistored text data bss dec hex filename 6403034 136996 105784 6645814 656836 go 2331118 85232 90984 2507334 264246 gofmt 16842586 190256 130320 17163162 105e39a camlistored Fixes #8604. LGTM=rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews https://golang.org/cl/137790043
2014-08-28runtime: fix Plan 9 build for new C calling conventionAnthony Martin
LGTM=0intro, rsc R=rsc, 0intro CC=golang-codereviews https://golang.org/cl/132320043
2014-08-28runtime: fix openbsd/386Matthew Dempsky
In revision 05c3fee13eb3, openbsd/386's tfork implementation was accidentally changed in one instruction from using the "params" parameter to using the "psize" parameter. While here, OpenBSD's __tfork system call returns a pid_t which is an int32 on all OpenBSD architectures, so change runtime.tfork's return type from int64 to int32 and update the assembly implementations accordingly. LGTM=iant R=rsc, iant CC=golang-codereviews, jsing https://golang.org/cl/133190043
2014-08-28runtime: move finalizer thread to Go.Keith Randall
LGTM=dvyukov R=golang-codereviews, dvyukov, khr CC=golang-codereviews https://golang.org/cl/124630043
2014-08-28runtime: compare only until min(len(s1), len(s2))David Crawshaw
LGTM=bradfitz R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/139770043
2014-08-28runtime: fix arm buildDavid Crawshaw
LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/134030043
2014-08-28runtime: fix buildRuss Cox
'range hash' makes a copy of the hash array in the stack, creating a very large stack frame. It's just the right amount that it uses most but not all of the total stack size. If you have a lot of environment variables, like the builders, then this is too much and the g0 stack runs out of space. TBR=bradfitz CC=golang-codereviews https://golang.org/cl/132350043
2014-08-28runtime: convert runtime1.goc, noasm_arm.goc to GoRuss Cox
LGTM=dvyukov R=golang-codereviews, bradfitz, dvyukov CC=golang-codereviews, iant, khr https://golang.org/cl/135070043
2014-08-28runtime: finish converting iface.goc to iface.goRuss Cox
LGTM=bradfitz, dvyukov R=golang-codereviews, bradfitz, dvyukov CC=golang-codereviews, iant, khr https://golang.org/cl/131510043
2014-08-27runtime: fix nacl/386 buildRuss Cox
I changed all the NACL_SYSJMP to NACL_SYSCALL in an earlier CL, but I missed the fact that NACL_SYSCALL will push another return PC on the stack, so that the arguments will no longer be in the right place. Since we have to make our own call, we also have to copy the arguments. Do that. Fixes nacl/386 build. TBR=minux CC=golang-codereviews https://golang.org/cl/135050044
2014-08-27cmd/api: fix for Lock⇒Mutex changeRuss Cox
TBR=iant CC=golang-codereviews https://golang.org/cl/133150043
2014-08-27runtime: rename Lock to MutexRuss Cox
Mutex is consistent with package sync, and when in the unexported Go form it avoids having a conflcit between the type (now mutex) and the function (lock). LGTM=iant R=golang-codereviews, iant CC=dvyukov, golang-codereviews, r https://golang.org/cl/133140043
2014-08-27runtime: fix nacl buildRuss Cox
The NaCl "system calls" were assumed to have a compatible return convention with the C compiler, and we were using tail jumps to those functions. Don't do that anymore. Correct mistake introduced in newstackcall duringconversion from (SP) to (FP) notation. (Actually this fix, in asm_amd64p32.s, slipped into the C compiler change, but update the name to match what go vet wants.) Correct computation of caller stack pointer in morestack: on amd64p32, the saved PC is the size of a uintreg, not uintptr. This may not matter, since it's been like this for a while, but uintreg is the correct one. (And on non-NaCl they are the same.) This will allow the NaCl build to get much farther. It will probably still not work completely. There's a bug in 6l that needs fixing too. TBR=minux CC=golang-codereviews https://golang.org/cl/134990043
2014-08-28runtime: fix arm5 softfloat buildDave Cheney
runtime._sfloat2 now returns the lr value on the stack, not R0. Credit to Russ Cox for the fix. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/133120045
2014-08-27runtime: fix arm buildRuss Cox
TBR=minux CC=golang-codereviews https://golang.org/cl/137810043
2014-08-27cmd/cc, runtime: preserve C runtime type names in generated GoRuss Cox
uintptr or uint64 in the runtime C were turning into uint in the Go, bool was turning into uint8, and so on. Fix that. Also delete Go wrappers for C functions. The C functions can be called directly now (but still eventually need to be converted to Go). LGTM=bradfitz, minux, iant R=golang-codereviews, bradfitz, iant, minux CC=golang-codereviews, khr, r https://golang.org/cl/138740043
2014-08-27cmd/{ld,link,objdump}, runtime, debug/gosym: move linker-defined symbols ↵Matthew Dempsky
into runtime package Fixes #8092. LGTM=rsc R=iant, rsc CC=golang-codereviews https://golang.org/cl/126790043
2014-08-27runtime: fix plan9 buildRuss Cox
sighandler now returns its value on the stack. TBR=0intro CC=golang-codereviews https://golang.org/cl/135900043
2014-08-27runtime: fix solaris buildRuss Cox
nanotime1 is not a Go function and must not store its result at 0(FP). That overwrites some data owned by the caller. TBR=aram CC=golang-codereviews https://golang.org/cl/138730043
2014-08-27runtime: fix windows signal handlersRuss Cox
Windows needs the return result in AX, but runtime.sighandler no longer stores it in AX. Load it back during the assembly trampoline. TBR=brainman CC=golang-codereviews https://golang.org/cl/133980043
2014-08-27runtime: give nosplit functions 32 more bytes of headroomRuss Cox
The Go calling convention uses more stack space than C. On 64-bit systems we've been right up against the limit (128 bytes, so only 16 words) and doing awful things to our source code to work around it. Instead of continuing to do awful things, raise the limit to 160 bytes. I am prepared to raise the limit to 192 bytes if necessary, but I think this will be enough. Should fix current link-time stack overflow errors on - nacl/arm - netbsd/amd64 - openbsd/amd64 - solaris/amd64 - windows/amd64 TBR=r CC=golang-codereviews, iant https://golang.org/cl/131450043
2014-08-27runtime: restore header to first goroutine in StackBrad Fitzpatrick
It appears to have been accidentally lost when converting Stack from C to Go in https://golang.org/cl/129510043 LGTM=rsc R=golang-codereviews CC=golang-codereviews, josharian, khr, remyoudompheng, rsc https://golang.org/cl/136870043
2014-08-27cmd/cc, runtime: convert C compilers to use Go calling conventionRuss Cox
To date, the C compilers and Go compilers differed only in how values were returned from functions. This made it difficult to call Go from C or C from Go if return values were involved. It also made assembly called from Go and assembly called from C different. This CL changes the C compiler to use the Go conventions, passing results on the stack, after the arguments. [Exception: this does not apply to C ... functions, because you can't know where on the stack the arguments end.] By doing this, the CL makes it possible to rewrite C functions into Go one at a time, without worrying about which languages call that function or which languages it calls. This CL also updates all the assembly files in package runtime to use the new conventions. Argument references of the form 40(SP) have been rewritten to the form name+10(FP) instead, and there are now Go func prototypes for every assembly function called from C or Go. This means that 'go vet runtime' checks effectively every assembly function, and go vet's output was used to automate the bulk of the conversion. Some functions, like seek and nsec on Plan 9, needed to be rewritten. Many assembly routines called from C were reading arguments incorrectly, using MOVL instead of MOVQ or vice versa, especially on the less used systems like openbsd. These were found by go vet and have been corrected too. If we're lucky, this may reduce flakiness on those systems. Tested on: darwin/386 darwin/amd64 linux/arm linux/386 linux/amd64 If this breaks another system, the bug is almost certainly in the sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested by the combination of the above systems. LGTM=dvyukov, iant R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant CC=golang-codereviews, josharian, r https://golang.org/cl/135830043
2014-08-27runtime: changes to g->atomicstatus (nee status) to support concurrent GCRick Hudson
Every change to g->atomicstatus is now done atomically so that we can ensure that all gs pass through a gc safepoint on demand. This allows the GC to move from one phase to the next safely. In some phases the stack will be scanned. This CL only deals with the infrastructure that allows g->atomicstatus to go from one state to another. Future CLs will deal with scanning and monitoring what phase the GC is in. The major change was to moving to using a Gscan bit to indicate that the status is in a scan state. The only bug fix was in oldstack where I wasn't moving to a Gcopystack state in order to block scanning until the new stack was in place. The proc.go file is waiting for an atomic load instruction. LGTM=rsc R=golang-codereviews, dvyukov, josharian, rsc CC=golang-codereviews, khr https://golang.org/cl/132960044
2014-08-26runtime: name hi and lo parts of ret in assemblyJosh Bleecher Snyder
Makes vet happy. LGTM=bradfitz R=dvyukov, bradfitz CC=golang-codereviews https://golang.org/cl/131320043
2014-08-26runtime: convert Stack to Go.Rémy Oudompheng
LGTM=khr R=khr, josharian CC=golang-codereviews https://golang.org/cl/129510043
2014-08-26runtime: convert int64tofloat64, uint64tofloat64 to GoDave Cheney
I noticed that 5g doesn't flush the float64 result back to the stack, hence the change in the function signature. I'm wondering if I should also change the signature for the other two functions. LGTM=rsc R=minux, josharian, rsc CC=golang-codereviews https://golang.org/cl/132990044
2014-08-26runtime,sync: Convert procPin and procUnpin functions to Go.Sanjay Menakuru
LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews, khr https://golang.org/cl/132880043
2014-08-25runtime: restore scavenger constantsDmitriy Vyukov
Once and for all. Broken in cl/108640043. I've messed it before. To test scavenger-related changes one needs to alter the constants during final testing. And then it's very easy to submit with the altered constants. LGTM=rsc R=golang-codereviews CC=golang-codereviews, rsc https://golang.org/cl/136720044
2014-08-25runtime: restore nacl timensDmitriy Vyukov
Deleted in cl/123700044. I am not sure whether I need to restore it, or delete rest of the uses... LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/129580043
2014-08-25cmd/gc, runtime: treat slices and strings like pointers in garbage collectionRuss Cox
Before, a slice with cap=0 or a string with len=0 might have its base pointer pointing beyond the actual slice/string data into the next block. The collector had to ignore slices and strings with cap=0 in order to avoid misinterpreting the base pointer. Now, a slice with cap=0 or a string with len=0 still has a base pointer pointing into the actual slice/string data, no matter what. The collector can now always scan the pointer, which means strings and slices are no longer special. Fixes #8404. LGTM=khr, josharian R=josharian, khr, dvyukov CC=golang-codereviews https://golang.org/cl/112570044
2014-08-25runtime: round channel size in allocation instead of using system-specific ↵Russ Cox
pad field Followup to CL 128700043. LGTM=bradfitz, dvyukov R=dvyukov, bradfitz CC=golang-codereviews https://golang.org/cl/133850043
2014-08-25runtime: remove dedicated scavenger threadDmitriy Vyukov
A whole thread is too much for background scavenger that sleeps all the time anyway. We already have sysmon thread that can do this work. Also remove g->isbackground and simplify enter/exitsyscall. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr, rlh https://golang.org/cl/108640043
2014-08-25runtime: add commentDmitriy Vyukov
Explain why it's safe to allocate chans with flagNoScan. LGTM=rsc R=golang-codereviews CC=golang-codereviews, khr, rsc https://golang.org/cl/125510045
2014-08-25runtime: convert timers to GoDmitriy Vyukov
LGTM=rsc R=golang-codereviews, ruiu, rsc, daniel.morsing CC=golang-codereviews, khr https://golang.org/cl/123700044
2014-08-25runtime: convert async semaphores to GoDmitriy Vyukov
LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr https://golang.org/cl/126210046
2014-08-25runtime: fix plan9 HeapSys accountingDmitriy Vyukov
LGTM=0intro R=0intro CC=golang-codereviews https://golang.org/cl/131190043
2014-08-25runtime: fix chan alignment on 32 bitsDmitriy Vyukov
LGTM=dave R=golang-codereviews, dave CC=golang-codereviews, khr, rsc https://golang.org/cl/128700043
2014-08-25runtime: refactor CPU profilingDmitriy Vyukov
Reduce duration of critical section, make pcbuf local to function. LGTM=rsc R=golang-codereviews CC=golang-codereviews, rsc https://golang.org/cl/102600043
2014-08-25runtime: fix block profile for sync semaphoresDmitriy Vyukov
Part of cl/128670043 that got lost during submit. TBR=rsc R=golang-codereviews CC=golang-codereviews https://golang.org/cl/129570043
2014-08-25runtime: fix block profile for sync semaphoresDmitriy Vyukov
And add a test. LGTM=rsc R=golang-codereviews CC=golang-codereviews, khr, rsc https://golang.org/cl/128670043
2014-08-25runtime: add fast paths to non-blocking channel operationsDmitriy Vyukov
benchmark old ns/op new ns/op delta BenchmarkChanNonblocking 27.8 7.80 -71.94% BenchmarkChanNonblocking-2 79.1 3.94 -95.02% BenchmarkChanNonblocking-4 71.2 2.04 -97.13% LGTM=rsc R=golang-codereviews, rsc, dave CC=golang-codereviews https://golang.org/cl/110580043
2014-08-25runtime: Loosen conditions in TestMemstat in an attempt to fix the nacl/arm ↵Sanjay Menakuru
build. LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews, khr https://golang.org/cl/128680043
2014-08-25runtime: convert NewCallback and NewCallbackCDecl to GoAlex Brainman
LGTM=khr R=khr, remyoudompheng CC=golang-codereviews https://golang.org/cl/132820043
2014-08-24runtime,runtime/debug: Converted some functions from goc to Go.Sanjay Menakuru
LGTM=khr R=golang-codereviews, khr CC=dvyukov, golang-codereviews https://golang.org/cl/131010044