summaryrefslogtreecommitdiff
path: root/src/runtime/asm_386.s
Commit message (Collapse)AuthorAgeFilesLines
* [dev.garbage] runtime: add prefetcht0, prefetcht1, prefetcht2, prefetcht3, ↵Russ Cox2014-11-211-0/+20
| | | | | | | | | | | | | | | | | prefetchnta for GC We don't know what we need yet, so add them all. Add them even on x86 architectures (as no-ops) so that the GC can refer to them unconditionally. Eventually we'll know what we want and probably have just one 'prefetch' with an appropriate meaning on each architecture. LGTM=rlh R=rlh CC=golang-codereviews https://codereview.appspot.com/179160043
* [dev.cc] all: merge dev.power64 (7667e41f3ced) into dev.ccRuss Cox2014-11-141-38/+33
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes. These are the files that had merge conflicts and have been edited by hand: malloc.go mem_linux.go mgc.go os1_linux.go proc1.go panic1.go runtime1.go LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/174180043
| * [dev.cc] runtime: delete scalararg, ptrarg; rename onM to systemstackRuss Cox2014-11-121-33/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scalararg and ptrarg are not "signal safe". Go code filling them out can be interrupted by a signal, and then the signal handler runs, and if it also ends up in Go code that uses scalararg or ptrarg, now the old values have been smashed. For the pieces of code that do need to run in a signal handler, we introduced onM_signalok, which is really just onM except that the _signalok is meant to convey that the caller asserts that scalarg and ptrarg will be restored to their old values after the call (instead of the usual behavior, zeroing them). Scalararg and ptrarg are also untyped and therefore error-prone. Go code can always pass a closure instead of using scalararg and ptrarg; they were only really necessary for C code. And there's no more C code. For all these reasons, delete scalararg and ptrarg, converting the few remaining references to use closures. Once those are gone, there is no need for a distinction between onM and onM_signalok, so replace both with a single function equivalent to the current onM_signalok (that is, it can be called on any of the curg, g0, and gsignal stacks). The name onM and the phrase 'm stack' are misnomers, because on most system an M has two system stacks: the main thread stack and the signal handling stack. Correct the misnomer by naming the replacement function systemstack. Fix a few references to "M stack" in code. The main motivation for this change is to eliminate scalararg/ptrarg. Rick and I have already seen them cause problems because the calling sequence m.ptrarg[0] = p is a heap pointer assignment, so it gets a write barrier. The write barrier also uses onM, so it has all the same problems as if it were being invoked by a signal handler. We worked around this by saving and restoring the old values and by calling onM_signalok, but there's no point in keeping this nice home for bugs around any longer. This CL also changes funcline to return the file name as a result instead of filling in a passed-in *string. (The *string signature is left over from when the code was written in and called from C.) That's arguably an unrelated change, except that once I had done the ptrarg/scalararg/onM cleanup I started getting false positives about the *string argument escaping (not allowed in package runtime). The compiler is wrong, but the easiest fix is to write the code like Go code instead of like C code. I am a bit worried that the compiler is wrong because of some use of uninitialized memory in the escape analysis. If that's the reason, it will go away when we convert the compiler to Go. (And if not, we'll debug it the next time.) LGTM=khr R=r, khr CC=austin, golang-codereviews, iant, rlh https://codereview.appspot.com/174950043
| * [dev.cc] runtime: convert assembly files for C to Go transitionRuss Cox2014-11-111-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main change is that #include "zasm_GOOS_GOARCH.h" is now #include "go_asm.h" and/or #include "go_tls.h". Also, because C StackGuard is now Go _StackGuard, the assembly name changes from const_StackGuard to const__StackGuard. In asm_$GOARCH.s, add new function getg, formerly implemented in C. The renamed atomics now have Go wrappers, to get escape analysis annotations right. Those wrappers are in CL 174860043. LGTM=r, aram R=r, aram CC=austin, dvyukov, golang-codereviews, iant, khr https://codereview.appspot.com/168510043
* | [dev.power64] all: merge default into dev.power64Austin Clements2014-11-031-29/+29
|\ \ | |/ |/| | | | | | | | | | | | | | | Trivial merge except for src/runtime/asm_power64x.s and src/runtime/signal_power64x.c LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/168950044
| * [dev.power64] all: merge default (dd5014ed9b01) into dev.power64Russ Cox2014-10-291-29/+29
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Still passes on amd64. LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/165110043
| | * [dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scopedRuss Cox2014-10-281-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I removed support for jumping between functions years ago, as part of doing the instruction layout for each function separately. Given that, it makes sense to treat labels as function-scoped. This lets each function have its own 'loop' label, for example. Makes the assembly much cleaner and removes the last reason anyone would reach for the 123(PC) form instead. Note that this is on the dev.power64 branch, but it changes all the assemblers. The change will ship in Go 1.5 (perhaps after being ported into the new assembler). Came up as part of CL 167730043. LGTM=r R=r CC=austin, dave, golang-codereviews, minux https://codereview.appspot.com/159670043
* | | runtime: change top-most return PC from goexit to goexit+PCQuantumRuss Cox2014-10-291-0/+6
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you get a stack of PCs from Callers, it would be expected that every PC is immediately after a call instruction, so to find the line of the call, you look up the line for PC-1. CL 163550043 now explicitly documents that. The most common exception to this is the top-most return PC on the stack, which is the entry address of the runtime.goexit function. Subtracting 1 from that PC will end up in a different function entirely. To remove this special case, make the top-most return PC goexit+PCQuantum and then implement goexit in assembly so that the first instruction can be skipped. Fixes issue 7690. LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/170720043
* | runtime: fix unrecovered panic on external threadRuss Cox2014-10-281-0/+14
|/ | | | | | | | | Fixes issue 8588. LGTM=austin R=austin CC=golang-codereviews, khr https://codereview.appspot.com/159700044
* runtime: warn that cputicks() might not be monotonic.Keith Randall2014-10-211-6/+0
| | | | | | | | | Get rid of gocputicks(), it is no longer used. LGTM=bradfitz, dave R=golang-codereviews, bradfitz, dave, minux CC=golang-codereviews https://codereview.appspot.com/161110044
* runtime: remove hand-generated ptr bitmaps for reflectcallRuss Cox2014-10-151-42/+30
| | | | | | | | | | | | | | | | A Go prototype can be used instead now, and the compiler will do a better job than we will doing it by hand. (We got it wrong in amd64p32, causing the current build breakage.) The auto-prototype-matching only applies to functions without an explicit package path, so the TEXT lines for reflectcall and callXX are s/runtime?/?/. LGTM=khr R=khr CC=golang-codereviews, iant, r https://codereview.appspot.com/153600043
* runtime: change Windows M.thread from void* to uintptrRuss Cox2014-10-071-0/+3
| | | | | | | | | | | | It appears to be an opaque bit pattern more than a pointer. The Go garbage collector has discovered that for m0 it is set to 0x4c. Should fix Windows build. TBR=brainman CC=golang-codereviews https://codereview.appspot.com/149640043
* runtime: add load_g call in arm callback.Keith Randall2014-09-251-1/+1
| | | | | | | | | Need to restore the g register. Somehow this line vaporized from CL 144130043. Also cgo_topofstack -> _cgo_topofstack, that vaporized also. TBR=rsc CC=golang-codereviews https://codereview.appspot.com/150940044
* cgo: adjust return value location to account for stack copies.Keith Randall2014-09-251-0/+10
| | | | | | | | | | | | | | | | During a cgo call, the stack can be copied. This copy invalidates the pointer that cgo has into the return value area. To fix this problem, pass the address of the location containing the stack top value (which is in the G struct). For cgo functions which return values, read the stktop before and after the cgo call to compute the adjustment necessary to write the return value. Fixes issue 8771 LGTM=iant, rsc R=iant, rsc, khr CC=golang-codereviews https://codereview.appspot.com/144130043
* cmd/cc, cmd/ld, runtime: disallow conservative data/bss objectsRuss Cox2014-09-241-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In linker, refuse to write conservative (array of pointers) as the garbage collection type for any variable in the data/bss GC program. In the linker, attach the Go type to an already-read C declaration during dedup. This gives us Go types for C globals for free as long as the cmd/dist-generated Go code contains the declaration. (Most runtime C declarations have a corresponding Go declaration. Both are bss declarations and so the linker dedups them.) In cmd/dist, add a few more C files to the auto-Go-declaration list in order to get Go type information for the C declarations into the linker. In C compiler, mark all non-pointer-containing global declarations and all string data as NOPTR. This allows them to exist in C files without any corresponding Go declaration. Count C function pointers as "non-pointer-containing", since we have no heap-allocated C functions. In runtime, add NOPTR to the remaining pointer-containing declarations, none of which refer to Go heap objects. In runtime, also move os.Args and syscall.envs data into runtime-owned variables. Otherwise, in programs that do not import os or syscall, the runtime variables named os.Args and syscall.envs will be missing type information. I believe that this CL eliminates the final source of conservative GC scanning in non-SWIG Go programs, and therefore... Fixes issue 909. LGTM=iant R=iant CC=golang-codereviews https://codereview.appspot.com/149770043
* liblink: make GO_ARGS the default for functions beginning with ?Russ Cox2014-09-161-6/+3
| | | | | | | | | | | | | | | | | If there is a leading ?, assume there is a Go prototype and attach the Go prototype information to the function. If the function is not called from Go and does not need a Go prototype, it can be made file-local instead (using name<>(SB)). This fixes the current BSD build failures, by giving functions like sync/atomic.StoreUint32 argument stack map information. Fixes issue 8753. LGTM=khr, iant R=golang-codereviews, iant, khr, bradfitz CC=golang-codereviews, r, rlh https://codereview.appspot.com/142150043
* runtime: mark asmcgocall<>(SB) as having no argumentsRuss Cox2014-09-141-1/+2
| | | | | | | | | | | | | | | It doesn't. Fixes 386 build. While we're here, mark runtime.asmcgocall as GO_ARGS, so that it will work with stack copying. I don't think anything that uses it can lead to a stack copy, but better safe than sorry. Certainly the runtime.asmcgocall_errno variant needs (and already has) GO_ARGS. TBR=iant CC=golang-codereviews https://codereview.appspot.com/138400043
* runtime: stop scanning stack frames/args conservativelyRuss Cox2014-09-121-4/+5
| | | | | | | | | | | | | | | | | | | | | | | The goal here is to commit fully to having precise information about stack frames. If we need information we don't have, crash instead of assuming we should scan conservatively. Since the stack copying assumes fully precise information, any crashes during garbage collection that are introduced by this CL are crashes that could have happened during stack copying instead. Those are harder to find because stacks are copied much less often than the garbage collector is invoked. In service of that goal, remove ARGSIZE macros from asm_*.s, change switchtoM to have no arguments (it doesn't have any live arguments), and add args and locals information to some frames that can call back into Go. LGTM=khr R=khr, rlh CC=golang-codereviews https://codereview.appspot.com/137540043
* runtime: fix cgo to handle the case where the G stack is copied.Keith Randall2014-09-111-2/+6
| | | | | | | | | | | Tests will come in a separate CL after the funcdata stuff is resolved. Update issue 8696 LGTM=iant, rsc R=rsc, iant CC=golang-codereviews https://codereview.appspot.com/138330045
* runtime: allow crash from gsignal stackRuss Cox2014-09-111-0/+17
| | | | | | | | | | | The uses of onM in dopanic/startpanic are okay even from the signal stack. Fixes issue 8666. LGTM=khr R=khr CC=golang-codereviews https://codereview.appspot.com/134710043
* runtime: more cleanupsKeith Randall2014-09-091-3/+0
| | | | | | | | | | Move timenow thunk into time.s Move declarations for generic c/asm services into stubs.go LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/137360043
* runtime: fix build failures after CL 137410043Russ Cox2014-09-091-1/+1
| | | | | | | | No promise about correctness, but they do build. TBR=khr CC=golang-codereviews https://codereview.appspot.com/143720043
* runtime: assume precisestack, copystack, StackCopyAlways, ScanStackByFramesRuss Cox2014-09-091-41/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit to stack copying for stack growth. We're carrying around a surprising amount of cruft from older schemes. I am confident that precise stack scans and stack copying are here to stay. Delete fallback code for when precise stack info is disabled. Delete fallback code for when copying stacks is disabled. Delete fallback code for when StackCopyAlways is disabled. Delete Stktop chain - there is only one stack segment now. Delete M.moreargp, M.moreargsize, M.moreframesize, M.cret. Delete G.writenbuf (unrelated, just dead). Delete runtime.lessstack, runtime.oldstack. Delete many amd64 morestack variants. Delete initialization of morestack frame/arg sizes (shortens split prologue!). Replace G's stackguard/stackbase/stack0/stacksize/ syscallstack/syscallguard/forkstackguard with simple stack bounds (lo, hi). Update liblink, runtime/cgo for adjustments to G. LGTM=khr R=khr, bradfitz CC=golang-codereviews, iant, r https://codereview.appspot.com/137410043
* runtime: a few cleanups.Keith Randall2014-09-081-2/+2
| | | | | | | LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://codereview.appspot.com/134630043
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+2292
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.