LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 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.h" | 6 #include "arch.h" |
7 #include "defs.h" | 7 #include "defs.h" |
8 #include "malloc.h" | 8 #include "malloc.h" |
9 #include "os.h" | 9 #include "os.h" |
10 #include "stack.h" | 10 #include "stack.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 runtime·allm = m; | 113 runtime·allm = m; |
114 m->nomemprof++; | 114 m->nomemprof++; |
115 | 115 |
116 runtime·mallocinit(); | 116 runtime·mallocinit(); |
117 runtime·goargs(); | 117 runtime·goargs(); |
118 runtime·goenvs(); | 118 runtime·goenvs(); |
119 | 119 |
120 // For debugging: | 120 // For debugging: |
121 // Allocate internal symbol table representation now, | 121 // Allocate internal symbol table representation now, |
122 // so that we don't need to call malloc when we crash. | 122 // so that we don't need to call malloc when we crash. |
123 » runtime·findfunc(0); | 123 » // runtime·findfunc(0); |
124 | 124 |
125 runtime·gomaxprocs = 1; | 125 runtime·gomaxprocs = 1; |
126 p = runtime·getenv("GOMAXPROCS"); | 126 p = runtime·getenv("GOMAXPROCS"); |
127 if(p != nil && (n = runtime·atoi(p)) != 0) | 127 if(p != nil && (n = runtime·atoi(p)) != 0) |
128 runtime·gomaxprocs = n; | 128 runtime·gomaxprocs = n; |
129 runtime·sched.mcpumax = runtime·gomaxprocs; | 129 runtime·sched.mcpumax = runtime·gomaxprocs; |
130 runtime·sched.mcount = 1; | 130 runtime·sched.mcount = 1; |
131 runtime·sched.predawn = 1; | 131 runtime·sched.predawn = 1; |
132 | 132 |
133 m->nomemprof--; | 133 m->nomemprof--; |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 framesize = m->moreframesize; | 674 framesize = m->moreframesize; |
675 argsize = m->moreargsize; | 675 argsize = m->moreargsize; |
676 g1 = m->curg; | 676 g1 = m->curg; |
677 | 677 |
678 if(m->morebuf.sp < g1->stackguard - StackGuard) { | 678 if(m->morebuf.sp < g1->stackguard - StackGuard) { |
679 runtime·printf("runtime: split stack overflow: %p < %p\n", m->mo
rebuf.sp, g1->stackguard - StackGuard); | 679 runtime·printf("runtime: split stack overflow: %p < %p\n", m->mo
rebuf.sp, g1->stackguard - StackGuard); |
680 runtime·throw("runtime: split stack overflow"); | 680 runtime·throw("runtime: split stack overflow"); |
681 } | 681 } |
682 if(argsize % sizeof(uintptr) != 0) { | 682 if(argsize % sizeof(uintptr) != 0) { |
683 runtime·printf("runtime: stack split with misaligned argsize %d\
n", argsize); | 683 runtime·printf("runtime: stack split with misaligned argsize %d\
n", argsize); |
684 » » runtime·printf("runtime: stack split argsize"); | 684 » » runtime·throw("runtime: stack split argsize"); |
685 } | 685 } |
686 | 686 |
687 reflectcall = framesize==1; | 687 reflectcall = framesize==1; |
688 if(reflectcall) | 688 if(reflectcall) |
689 framesize = 0; | 689 framesize = 0; |
690 | 690 |
691 if(reflectcall && m->morebuf.sp - sizeof(Stktop) - argsize - 32 > g1->st
ackguard) { | 691 if(reflectcall && m->morebuf.sp - sizeof(Stktop) - argsize - 32 > g1->st
ackguard) { |
692 // special case: called from reflect.call (framesize==1) | 692 // special case: called from reflect.call (framesize==1) |
693 // to call code with an arbitrary argument size, | 693 // to call code with an arbitrary argument size, |
694 // and we have enough space on the current stack. | 694 // and we have enough space on the current stack. |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 runtime·badmcall(void) // called from assembly | 1215 runtime·badmcall(void) // called from assembly |
1216 { | 1216 { |
1217 runtime·throw("runtime: mcall called on m->g0 stack"); | 1217 runtime·throw("runtime: mcall called on m->g0 stack"); |
1218 } | 1218 } |
1219 | 1219 |
1220 void | 1220 void |
1221 runtime·badmcall2(void) // called from assembly | 1221 runtime·badmcall2(void) // called from assembly |
1222 { | 1222 { |
1223 runtime·throw("runtime: mcall function returned"); | 1223 runtime·throw("runtime: mcall function returned"); |
1224 } | 1224 } |
LEFT | RIGHT |