|
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.
Total comments: 5
Total comments: 5
Total comments: 15
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+586 lines, -67 lines) |
Patch |
 |
M |
src/pkg/runtime/malloc.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
3 chunks |
+29 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_darwin.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_dragonfly.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_freebsd.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_linux.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_netbsd.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_openbsd.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_plan9.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_solaris.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mem_windows.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
2 chunks |
+13 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mgc0.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
7 chunks |
+11 lines, -27 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/proc.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
5 chunks |
+45 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/runtime.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
3 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/stack.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/stack.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
9 chunks |
+426 lines, -32 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/traceback_arm.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
2 chunks |
+5 lines, -3 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/traceback_x86.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
2 chunks |
+5 lines, -3 lines |
0 comments
|
Download
|
Total messages: 29
|