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 // Page heap. | 5 // Page heap. |
6 // | 6 // |
7 // See malloc.h for overview. | 7 // See malloc.h for overview. |
8 // | 8 // |
9 // When a MSpan is in the heap free list, state == MSpanFree | 9 // When a MSpan is in the heap free list, state == MSpanFree |
10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span. | 10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span. |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 tick = limit/2; | 377 tick = limit/2; |
378 | 378 |
379 trace = false; | 379 trace = false; |
380 env = runtime·getenv("GOGCTRACE"); | 380 env = runtime·getenv("GOGCTRACE"); |
381 if(env != nil) | 381 if(env != nil) |
382 trace = runtime·atoi(env) > 0; | 382 trace = runtime·atoi(env) > 0; |
383 | 383 |
384 h = &runtime·mheap; | 384 h = &runtime·mheap; |
385 for(k=0;; k++) { | 385 for(k=0;; k++) { |
386 runtime·noteclear(¬e); | 386 runtime·noteclear(¬e); |
387 » » runtime·entersyscall(); | 387 » » runtime·entersyscallblock(); |
388 runtime·notetsleep(¬e, tick); | 388 runtime·notetsleep(¬e, tick); |
389 runtime·exitsyscall(); | 389 runtime·exitsyscall(); |
390 | 390 |
391 runtime·lock(h); | 391 runtime·lock(h); |
392 now = runtime·nanotime(); | 392 now = runtime·nanotime(); |
393 if(now - mstats.last_gc > forcegc) { | 393 if(now - mstats.last_gc > forcegc) { |
394 runtime·unlock(h); | 394 runtime·unlock(h); |
395 // The scavenger can not block other goroutines, | 395 // The scavenger can not block other goroutines, |
396 // otherwise deadlock detector can fire spuriously. | 396 // otherwise deadlock detector can fire spuriously. |
397 // GC blocks other goroutines via the runtime·worldsema. | 397 // GC blocks other goroutines via the runtime·worldsema. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 runtime·printf("failed MSpanList_Insert %p %p %p\n", span, span-
>next, span->prev); | 487 runtime·printf("failed MSpanList_Insert %p %p %p\n", span, span-
>next, span->prev); |
488 runtime·throw("MSpanList_Insert"); | 488 runtime·throw("MSpanList_Insert"); |
489 } | 489 } |
490 span->next = list->next; | 490 span->next = list->next; |
491 span->prev = list; | 491 span->prev = list; |
492 span->next->prev = span; | 492 span->next->prev = span; |
493 span->prev->next = span; | 493 span->prev->next = span; |
494 } | 494 } |
495 | 495 |
496 | 496 |
LEFT | RIGHT |