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 // 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 byte *p; | 599 byte *p; |
600 | 600 |
601 work.nroot = 0; | 601 work.nroot = 0; |
602 | 602 |
603 // mark data+bss. | 603 // mark data+bss. |
604 for(p=data; p<ebss; p+=DataBlock) | 604 for(p=data; p<ebss; p+=DataBlock) |
605 addroot(p, p+DataBlock < ebss ? DataBlock : ebss-p); | 605 addroot(p, p+DataBlock < ebss ? DataBlock : ebss-p); |
606 | 606 |
607 for(gp=runtime·allg; gp!=nil; gp=gp->alllink) { | 607 for(gp=runtime·allg; gp!=nil; gp=gp->alllink) { |
608 switch(gp->status){ | 608 switch(gp->status){ |
609 » » » default: | 609 » » default: |
610 » » » » runtime·printf("unexpected G.status %d\n", gp->s
tatus); | 610 » » » runtime·printf("unexpected G.status %d\n", gp->status); |
611 » » » » runtime·throw("mark - bad status"); | 611 » » » runtime·throw("mark - bad status"); |
612 » » » case Gdead: | 612 » » case Gdead: |
613 » » » » break; | 613 » » » break; |
614 » » » case Grunning: | 614 » » case Grunning: |
615 » » » » if(gp != g) | 615 » » » if(gp != g) |
616 » » » » » runtime·throw("mark - world not stopped"
); | 616 » » » » runtime·throw("mark - world not stopped"); |
617 » » » » addstackroots(gp); | 617 » » » addstackroots(gp); |
618 » » » » break; | 618 » » » break; |
619 » » » case Grunnable: | 619 » » case Grunnable: |
620 » » » case Gsyscall: | 620 » » case Gsyscall: |
621 » » » case Gwaiting: | 621 » » case Gwaiting: |
622 » » » » addstackroots(gp); | 622 » » » addstackroots(gp); |
623 » » » » break; | 623 » » » break; |
624 } | 624 } |
625 } | 625 } |
626 | 626 |
627 runtime·walkfintab(addfinroots); | 627 runtime·walkfintab(addfinroots); |
628 | 628 |
629 for(fb=allfin; fb; fb=fb->alllink) | 629 for(fb=allfin; fb; fb=fb->alllink) |
630 addroot((byte*)fb->fin, fb->cnt*sizeof(fb->fin[0])); | 630 addroot((byte*)fb->fin, fb->cnt*sizeof(fb->fin[0])); |
631 } | 631 } |
632 | 632 |
633 static bool | 633 static bool |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 uintptr n; | 1250 uintptr n; |
1251 | 1251 |
1252 n = (h->arena_used - h->arena_start) / wordsPerBitmapWord; | 1252 n = (h->arena_used - h->arena_start) / wordsPerBitmapWord; |
1253 n = (n+bitmapChunk-1) & ~(bitmapChunk-1); | 1253 n = (n+bitmapChunk-1) & ~(bitmapChunk-1); |
1254 if(h->bitmap_mapped >= n) | 1254 if(h->bitmap_mapped >= n) |
1255 return; | 1255 return; |
1256 | 1256 |
1257 runtime·SysMap(h->arena_start - n, n - h->bitmap_mapped); | 1257 runtime·SysMap(h->arena_start - n, n - h->bitmap_mapped); |
1258 h->bitmap_mapped = n; | 1258 h->bitmap_mapped = n; |
1259 } | 1259 } |
LEFT | RIGHT |