diff options
| author | Keith Randall <khr@golang.org> | 2014-02-26 23:28:44 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2014-02-26 23:28:44 -0800 |
| commit | 1665b006a57099d7bdf5c9f1277784d36b7168d9 (patch) | |
| tree | b580dcbc40283a9ee36d08d65e9588c65b7d313a /src/pkg/runtime/traceback_arm.c | |
| parent | e5f01aee04dc6313c85dab78305adf499e1f7bfa (diff) | |
| download | go-1665b006a57099d7bdf5c9f1277784d36b7168d9.tar.xz | |
runtime: grow stack by copying
On stack overflow, if all frames on the stack are
copyable, we copy the frames to a new stack twice
as large as the old one. During GC, if a G is using
less than 1/4 of its stack, copy the stack to a stack
half its size.
TODO
- Do something about C frames. When a C frame is in the
stack segment, it isn't copyable. We allocate a new segment
in this case.
- For idempotent C code, we can abort it, copy the stack,
then retry. I'm working on a separate CL for this.
- For other C code, we can raise the stackguard
to the lowest Go frame so the next call that Go frame
makes triggers a copy, which will then succeed.
- Pick a starting stack size?
The plan is that eventually we reach a point where the
stack contains only copyable frames.
LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/54650044
Diffstat (limited to 'src/pkg/runtime/traceback_arm.c')
| -rw-r--r-- | src/pkg/runtime/traceback_arm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c index 3c23cd9fcd..171672a89d 100644 --- a/src/pkg/runtime/traceback_arm.c +++ b/src/pkg/runtime/traceback_arm.c @@ -10,7 +10,7 @@ void runtime·sigpanic(void); int32 -runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, uintptr *pcbuf, int32 max, void (*callback)(Stkframe*, void*), void *v, bool printall) +runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, uintptr *pcbuf, int32 max, bool (*callback)(Stkframe*, void*), void *v, bool printall) { int32 i, n, nprint, line; uintptr x, tracepc; @@ -140,8 +140,10 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, if(pcbuf != nil) pcbuf[n] = frame.pc; - if(callback != nil) - callback(&frame, v); + if(callback != nil) { + if(!callback(&frame, v)) + return n; + } if(printing) { if(printall || runtime·showframe(f, gp)) { // Print during crash. |
