summaryrefslogtreecommitdiff
path: root/src/runtime/asm_386.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-12 07:46:11 -0400
committerRuss Cox <rsc@golang.org>2014-09-12 07:46:11 -0400
commit9ea01429fd02bdfe62a88d24de5fbb9d574a2f2e (patch)
tree74fa1dba900e37ddd2d333a1a90dd2290f41916f /src/runtime/asm_386.s
parentb7709832debee316ddf16c56c15d7806bce63e06 (diff)
downloadgo-9ea01429fd02bdfe62a88d24de5fbb9d574a2f2e.tar.gz
runtime: stop scanning stack frames/args conservatively
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
Diffstat (limited to 'src/runtime/asm_386.s')
-rw-r--r--src/runtime/asm_386.s9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index 37ad09241..c9fd75bfc 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -102,9 +102,7 @@ ok:
// create a new goroutine to start program
PUSHL $runtime·main·f(SB) // entry
PUSHL $0 // arg size
- ARGSIZE(8)
CALL runtime·newproc(SB)
- ARGSIZE(-1)
POPL AX
POPL AX
@@ -206,7 +204,7 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-4
// lives at the bottom of the G stack from the one that lives
// at the top of the M stack because the one at the top of
// the M stack terminates the stack walk (see topofstack()).
-TEXT runtime·switchtoM(SB), NOSPLIT, $0-4
+TEXT runtime·switchtoM(SB), NOSPLIT, $0-0
RET
// func onM_signalok(fn func())
@@ -263,7 +261,6 @@ oncurg:
MOVL BX, SP
// call target function
- ARGSIZE(0)
MOVL DI, DX
MOVL 0(DI), DI
CALL DI
@@ -656,6 +653,7 @@ TEXT runtime·asmcgocall(SB),NOSPLIT,$0-8
RET
TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-12
+ GO_ARGS
MOVL fn+0(FP), AX
MOVL arg+4(FP), BX
CALL asmcgocall<>(SB)
@@ -716,6 +714,9 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$12-12
// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize)
// See cgocall.c for more details.
TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$12-12
+ GO_ARGS
+ NO_LOCAL_POINTERS
+
// If g is nil, Go did not create the current thread.
// Call needm to obtain one for temporary use.
// In this case, we're running on the thread stack, so there's