diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-01-29 20:52:43 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-01-29 20:52:43 +0000 |
commit | d6f2922e91928b5191a5c5f1b3a6b320712b5ce3 (patch) | |
tree | 4f2fad1f4b778519bdd5941185c7e1d032af055b /libgo/runtime/mheap.c | |
parent | 91bfca59095b1cca9d4364996866848eaaf76c26 (diff) | |
download | gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.zip gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.tar.gz gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.tar.bz2 |
libgo: Update Go library to master revision 15489/921e53d4863c.
From-SVN: r195560
Diffstat (limited to 'libgo/runtime/mheap.c')
-rw-r--r-- | libgo/runtime/mheap.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libgo/runtime/mheap.c b/libgo/runtime/mheap.c index 7be135b..1b478f9 100644 --- a/libgo/runtime/mheap.c +++ b/libgo/runtime/mheap.c @@ -138,7 +138,9 @@ HaveSpan: *(uintptr*)(t->start<<PageShift) = *(uintptr*)(s->start<<PageShift); // copy "needs zeroing" mark t->state = MSpanInUse; MHeap_FreeLocked(h, t); + t->unusedsince = s->unusedsince; // preserve age } + s->unusedsince = 0; // Record span info, because gc needs to be // able to map interior pointer to containing span. @@ -300,10 +302,12 @@ MHeap_FreeLocked(MHeap *h, MSpan *s) } mstats.heap_idle += s->npages<<PageShift; s->state = MSpanFree; - s->unusedsince = 0; - s->npreleased = 0; runtime_MSpanList_Remove(s); sp = (uintptr*)(s->start<<PageShift); + // Stamp newly unused spans. The scavenger will use that + // info to potentially give back some pages to the OS. + s->unusedsince = runtime_nanotime(); + s->npreleased = 0; // Coalesce with earlier, later spans. p = s->start; @@ -405,10 +409,10 @@ runtime_MHeap_Scavenger(void* dummy) runtime_entersyscall(); runtime_notesleep(¬e); runtime_exitsyscall(); + if(trace) + runtime_printf("scvg%d: GC forced\n", k); runtime_lock(h); now = runtime_nanotime(); - if (trace) - runtime_printf("scvg%d: GC forced\n", k); } sumreleased = 0; for(i=0; i < nelem(h->free)+1; i++) { @@ -419,7 +423,7 @@ runtime_MHeap_Scavenger(void* dummy) if(runtime_MSpanList_IsEmpty(list)) continue; for(s=list->next; s != list; s=s->next) { - if(s->unusedsince != 0 && (now - s->unusedsince) > limit) { + if((now - s->unusedsince) > limit) { released = (s->npages - s->npreleased) << PageShift; mstats.heap_released += released; sumreleased += released; |