LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2013 The Go Authors. All rights reserved. | 1 // Copyright 2013 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "arch_GOARCH.h" | 6 #include "arch_GOARCH.h" |
7 #include "malloc.h" | 7 #include "malloc.h" |
8 #include "stack.h" | 8 #include "stack.h" |
9 #include "funcdata.h" | 9 #include "funcdata.h" |
10 #include "typekind.h" | 10 #include "typekind.h" |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 bool newstackcall; | 869 bool newstackcall; |
870 | 870 |
871 if(g->m->forkstackguard) | 871 if(g->m->forkstackguard) |
872 runtime·throw("split stack after fork"); | 872 runtime·throw("split stack after fork"); |
873 if(g->m->morebuf.g != g->m->curg) { | 873 if(g->m->morebuf.g != g->m->curg) { |
874 runtime·printf("runtime: newstack called from g=%p\n" | 874 runtime·printf("runtime: newstack called from g=%p\n" |
875 "\tm=%p m->curg=%p m->g0=%p m->gsignal=%p\n", | 875 "\tm=%p m->curg=%p m->g0=%p m->gsignal=%p\n", |
876 g->m->morebuf.g, g->m, g->m->curg, g->m->g0, g->m->gsign
al); | 876 g->m->morebuf.g, g->m, g->m->curg, g->m->g0, g->m->gsign
al); |
877 runtime·throw("runtime: wrong goroutine in newstack"); | 877 runtime·throw("runtime: wrong goroutine in newstack"); |
878 } | 878 } |
| 879 if(g->throwsplit) |
| 880 runtime·throw("runtime: stack split at bad time"); |
879 | 881 |
880 // The goroutine must be executing in order to call newstack, so the pos
sible states are | 882 // The goroutine must be executing in order to call newstack, so the pos
sible states are |
881 // Grunning and Gsyscall (and, due to GC, also Gscanrunning and Gscansys
call).·· | 883 // Grunning and Gsyscall (and, due to GC, also Gscanrunning and Gscansys
call).·· |
882 | 884 |
883 // gp->status is usually Grunning, but it could be Gsyscall if a stack o
verflow | 885 // gp->status is usually Grunning, but it could be Gsyscall if a stack o
verflow |
884 // happens during a function call inside entersyscall. | 886 // happens during a function call inside entersyscall. |
885 gp = g->m->curg; | 887 gp = g->m->curg; |
886 oldstatus = runtime·readgstatus(gp) & ~Gscan; | 888 oldstatus = runtime·readgstatus(gp) & ~Gscan; |
887 framesize = g->m->moreframesize; | 889 framesize = g->m->moreframesize; |
888 argsize = g->m->moreargsize; | 890 argsize = g->m->moreargsize; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 if(gp->m != nil && gp->m->libcallsp != 0) | 1117 if(gp->m != nil && gp->m->libcallsp != 0) |
1116 return; | 1118 return; |
1117 #endif | 1119 #endif |
1118 if(StackDebug > 0) | 1120 if(StackDebug > 0) |
1119 runtime·printf("shrinking stack %D->%D\n", (uint64)oldsize, (uin
t64)newsize); | 1121 runtime·printf("shrinking stack %D->%D\n", (uint64)oldsize, (uin
t64)newsize); |
1120 nframes = copyabletopsegment(gp); | 1122 nframes = copyabletopsegment(gp); |
1121 if(nframes == -1) | 1123 if(nframes == -1) |
1122 return; | 1124 return; |
1123 copystack(gp, nframes, newsize); | 1125 copystack(gp, nframes, newsize); |
1124 } | 1126 } |
LEFT | RIGHT |