LEFT | RIGHT |
(no file at all) | |
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 // Garbage collector. | 5 // Garbage collector. |
6 | 6 |
7 #include "runtime.h" | 7 #include "runtime.h" |
8 #include "arch_GOARCH.h" | 8 #include "arch_GOARCH.h" |
9 #include "malloc.h" | 9 #include "malloc.h" |
10 #include "stack.h" | 10 #include "stack.h" |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 void *base; | 1450 void *base; |
1451 uintptr size; | 1451 uintptr size; |
1452 | 1452 |
1453 stk = (Stktop*)gp->stackbase; | 1453 stk = (Stktop*)gp->stackbase; |
1454 guard = gp->stackguard; | 1454 guard = gp->stackguard; |
1455 | 1455 |
1456 if(gp == g) | 1456 if(gp == g) |
1457 runtime·throw("can't scan our own stack"); | 1457 runtime·throw("can't scan our own stack"); |
1458 if((mp = gp->m) != nil && mp->helpgc) | 1458 if((mp = gp->m) != nil && mp->helpgc) |
1459 runtime·throw("can't scan gchelper stack"); | 1459 runtime·throw("can't scan gchelper stack"); |
1460 » if(gp->gcstack != (uintptr)nil) { | 1460 » if(gp->syscallstack != (uintptr)nil) { |
1461 // Scanning another goroutine that is about to enter or might | 1461 // Scanning another goroutine that is about to enter or might |
1462 // have just exited a system call. It may be executing code such | 1462 // have just exited a system call. It may be executing code such |
1463 // as schedlock and may have needed to start a new stack segment
. | 1463 // as schedlock and may have needed to start a new stack segment
. |
1464 // Use the stack segment and stack pointer at the time of | 1464 // Use the stack segment and stack pointer at the time of |
1465 // the system call instead, since that won't change underfoot. | 1465 // the system call instead, since that won't change underfoot. |
1466 » » sp = gp->gcsp; | 1466 » » sp = gp->syscallsp; |
1467 » » pc = gp->gcpc; | 1467 » » pc = gp->syscallpc; |
1468 lr = 0; | 1468 lr = 0; |
1469 » » stk = (Stktop*)gp->gcstack; | 1469 » » stk = (Stktop*)gp->syscallstack; |
1470 » » guard = gp->gcguard; | 1470 » » guard = gp->syscallguard; |
1471 } else { | 1471 } else { |
1472 // Scanning another goroutine's stack. | 1472 // Scanning another goroutine's stack. |
1473 // The goroutine is usually asleep (the world is stopped). | 1473 // The goroutine is usually asleep (the world is stopped). |
1474 sp = gp->sched.sp; | 1474 sp = gp->sched.sp; |
1475 pc = gp->sched.pc; | 1475 pc = gp->sched.pc; |
1476 lr = gp->sched.lr; | 1476 lr = gp->sched.lr; |
1477 | 1477 |
1478 // For function about to start, context argument is a root too. | 1478 // For function about to start, context argument is a root too. |
1479 if(gp->sched.ctxt != 0 && runtime·mlookup(gp->sched.ctxt, &base,
&size, nil)) | 1479 if(gp->sched.ctxt != 0 && runtime·mlookup(gp->sched.ctxt, &base,
&size, nil)) |
1480 addroot((Obj){base, size, 0}); | 1480 addroot((Obj){base, size, 0}); |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 uintptr n; | 2520 uintptr n; |
2521 | 2521 |
2522 n = (h->arena_used - h->arena_start) / wordsPerBitmapWord; | 2522 n = (h->arena_used - h->arena_start) / wordsPerBitmapWord; |
2523 n = ROUND(n, bitmapChunk); | 2523 n = ROUND(n, bitmapChunk); |
2524 if(h->bitmap_mapped >= n) | 2524 if(h->bitmap_mapped >= n) |
2525 return; | 2525 return; |
2526 | 2526 |
2527 runtime·SysMap(h->arena_start - n, n - h->bitmap_mapped); | 2527 runtime·SysMap(h->arena_start - n, n - h->bitmap_mapped); |
2528 h->bitmap_mapped = n; | 2528 h->bitmap_mapped = n; |
2529 } | 2529 } |
LEFT | RIGHT |