OLD | NEW |
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_GOARCH.h" | 6 #include "arch_GOARCH.h" |
7 #include "zaexperiment.h" | 7 #include "zaexperiment.h" |
8 #include "malloc.h" | 8 #include "malloc.h" |
9 #include "stack.h" | 9 #include "stack.h" |
10 #include "race.h" | 10 #include "race.h" |
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 | 1915 |
1916 if(gp->stackguard - StackGuard != gp->stack0) | 1916 if(gp->stackguard - StackGuard != gp->stack0) |
1917 runtime·throw("invalid stack in gfput"); | 1917 runtime·throw("invalid stack in gfput"); |
1918 stksize = gp->stackbase + sizeof(Stktop) - gp->stack0; | 1918 stksize = gp->stackbase + sizeof(Stktop) - gp->stack0; |
1919 if(stksize != gp->stacksize) { | 1919 if(stksize != gp->stacksize) { |
1920 runtime·printf("runtime: bad stacksize, goroutine %D, remain=%d,
last=%d\n", | 1920 runtime·printf("runtime: bad stacksize, goroutine %D, remain=%d,
last=%d\n", |
1921 gp->goid, (int32)gp->stacksize, (int32)stksize); | 1921 gp->goid, (int32)gp->stacksize, (int32)stksize); |
1922 runtime·throw("gfput: bad stacksize"); | 1922 runtime·throw("gfput: bad stacksize"); |
1923 } | 1923 } |
1924 top = (Stktop*)gp->stackbase; | 1924 top = (Stktop*)gp->stackbase; |
1925 » if(top->malloced) { | 1925 » if(stksize != StackMin) { |
1926 // non-standard stack size - free it. | 1926 // non-standard stack size - free it. |
1927 runtime·stackfree(gp, (void*)gp->stack0, top); | 1927 runtime·stackfree(gp, (void*)gp->stack0, top); |
1928 gp->stack0 = 0; | 1928 gp->stack0 = 0; |
1929 gp->stackguard = 0; | 1929 gp->stackguard = 0; |
1930 gp->stackguard0 = 0; | 1930 gp->stackguard0 = 0; |
1931 gp->stackbase = 0; | 1931 gp->stackbase = 0; |
1932 } | 1932 } |
1933 gp->schedlink = p->gfree; | 1933 gp->schedlink = p->gfree; |
1934 p->gfree = gp; | 1934 p->gfree = gp; |
1935 p->gfreecnt++; | 1935 p->gfreecnt++; |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 acquirep(p); | 2432 acquirep(p); |
2433 for(i = new-1; i > 0; i--) { | 2433 for(i = new-1; i > 0; i--) { |
2434 p = runtime·allp[i]; | 2434 p = runtime·allp[i]; |
2435 p->status = Pidle; | 2435 p->status = Pidle; |
2436 pidleput(p); | 2436 pidleput(p); |
2437 } | 2437 } |
2438 runtime·atomicstore((uint32*)&runtime·gomaxprocs, new); | 2438 runtime·atomicstore((uint32*)&runtime·gomaxprocs, new); |
2439 } | 2439 } |
2440 | 2440 |
2441 // Associate p and the current m. | 2441 // Associate p and the current m. |
| 2442 #pragma textflag NOSPLIT |
2442 static void | 2443 static void |
2443 acquirep(P *p) | 2444 acquirep(P *p) |
2444 { | 2445 { |
2445 if(m->p || m->mcache) | 2446 if(m->p || m->mcache) |
2446 runtime·throw("acquirep: already in go"); | 2447 runtime·throw("acquirep: already in go"); |
2447 if(p->m || p->status != Pidle) { | 2448 if(p->m || p->status != Pidle) { |
2448 » » runtime·printf("acquirep: p->m=%p(%d) p->status=%d\n", p->m, p->
m ? p->m->id : 0, p->status); | 2449 » » //runtime·printf("acquirep: p->m=%p(%d) p->status=%d\n", p->m, p
->m ? p->m->id : 0, p->status); |
2449 runtime·throw("acquirep: invalid p state"); | 2450 runtime·throw("acquirep: invalid p state"); |
2450 } | 2451 } |
2451 m->mcache = p->mcache; | 2452 m->mcache = p->mcache; |
2452 m->p = p; | 2453 m->p = p; |
2453 p->m = m; | 2454 p->m = m; |
2454 p->status = Prunning; | 2455 p->status = Prunning; |
2455 } | 2456 } |
2456 | 2457 |
2457 // Disassociate p and the current m. | 2458 // Disassociate p and the current m. |
2458 static P* | 2459 static P* |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 if(experiment[i+j] != name[j]) | 3135 if(experiment[i+j] != name[j]) |
3135 goto nomatch; | 3136 goto nomatch; |
3136 if(experiment[i+j] != '\0' && experiment[i+j] != ',') | 3137 if(experiment[i+j] != '\0' && experiment[i+j] != ',') |
3137 goto nomatch; | 3138 goto nomatch; |
3138 return 1; | 3139 return 1; |
3139 } | 3140 } |
3140 nomatch:; | 3141 nomatch:; |
3141 } | 3142 } |
3142 return 0; | 3143 return 0; |
3143 } | 3144 } |
OLD | NEW |