diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index 9e4acc206e..739c61e4f4 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -19,7 +19,6 @@ package runtime // Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K. #pragma dataflag NOPTR MHeap runtime·mheap; -MStats mstats; int32 runtime·checking; @@ -321,10 +320,7 @@ runtime·purgecachedstats(MCache *c) } } -// Size of the trailing by_size array differs between Go and C, -// NumSizeClasses was changed, but we can not change Go struct because of backward compatibility. -// sizeof_C_MStats is what C thinks about size of Go struct. -uintptr runtime·sizeof_C_MStats = sizeof(MStats) - (NumSizeClasses - 61) * sizeof(mstats.by_size[0]); +uintptr runtime·sizeof_C_MStats = sizeof(MStats); #define MaxArena32 (2U<<30) diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index e07cebc0a0..9f34b55461 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -90,7 +90,7 @@ typedef struct GCStats GCStats; enum { - PageShift = 13, + PageShift = 12, PageSize = 1<cnt == finq->cap) { if(finc == nil) { - finc = runtime·persistentalloc(FinBlockSize, 0, &mstats.gc_sys); - finc->cap = (FinBlockSize - sizeof(FinBlock)) / sizeof(Finalizer) + 1; + finc = runtime·persistentalloc(PageSize, 0, &mstats.gc_sys); + finc->cap = (PageSize - sizeof(FinBlock)) / sizeof(Finalizer) + 1; finc->alllink = allfin; allfin = finc; } @@ -2218,8 +2215,6 @@ gc(struct gc_args *args) runtime·MProf_GC(); } -extern uintptr runtime·sizeof_C_MStats; - void runtime·ReadMemStats(MStats *stats) { @@ -2231,9 +2226,7 @@ runtime·ReadMemStats(MStats *stats) m->gcing = 1; runtime·stoptheworld(); updatememstats(nil); - // Size of the trailing by_size array differs between Go and C, - // NumSizeClasses was changed, but we can not change Go struct because of backward compatibility. - runtime·memcopy(runtime·sizeof_C_MStats, stats, &mstats); + *stats = mstats; m->gcing = 0; m->locks++; runtime·semrelease(&runtime·worldsema); diff --git a/src/pkg/runtime/netpoll.goc b/src/pkg/runtime/netpoll.goc index 81471dca5b..2830f882d8 100644 --- a/src/pkg/runtime/netpoll.goc +++ b/src/pkg/runtime/netpoll.goc @@ -34,11 +34,6 @@ package net #define READY ((G*)1) #define WAIT ((G*)2) -enum -{ - PollBlockSize = 4*1024, -}; - struct PollDesc { PollDesc* link; // in pollcache, protected by pollcache.Lock @@ -427,7 +422,7 @@ allocPollDesc(void) runtime·lock(&pollcache); if(pollcache.first == nil) { - n = PollBlockSize/sizeof(*pd); + n = PageSize/sizeof(*pd); if(n == 0) n = 1; // Must be in non-GC memory because can be referenced