From: Leandro Lucarella Date: Sun, 29 Aug 2010 02:33:13 +0000 (-0300) Subject: Cache B_FREE pages also when marking X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/commitdiff_plain/c2e12ed73be29b2680115fbedc3486e77b7dbed5 Cache B_FREE pages also when marking The small page cache used when marking was only exploited by B_PAGE and B_PAGEPLUS pages, while B_FREE pages can benefit from it too. --- diff --git a/rt/gc/cdgc/gc.d b/rt/gc/cdgc/gc.d index 50018b3..f70227b 100644 --- a/rt/gc/cdgc/gc.d +++ b/rt/gc/cdgc/gc.d @@ -645,6 +645,10 @@ void mark_range(void *pbot, void *ptop, size_t* pm_bitmask) size_t pn = offset / PAGESIZE; Bins bin = cast(Bins)pool.pagetable[pn]; + // Cache B_PAGE, B_PAGEPLUS and B_FREE lookups + if (bin >= B_PAGE) + pcache = cast(size_t)p & ~(PAGESIZE-1); + // Adjust bit to be at start of allocated memory block if (bin <= B_PAGE) bit_i = (offset & notbinsize[bin]) >> 4; @@ -657,14 +661,8 @@ void mark_range(void *pbot, void *ptop, size_t* pm_bitmask) while (cast(Bins)pool.pagetable[pn] == B_PAGEPLUS); bit_i = pn * (PAGESIZE / 16); } - else - { - // Don't mark bits in B_FREE pages + else // Don't mark bits in B_FREE pages continue; - } - - if (bin >= B_PAGE) // Cache B_PAGE and B_PAGEPLUS lookups - pcache = cast(size_t)p & ~(PAGESIZE-1); if (!pool.mark.test(bit_i)) {