]> git.llucax.com Git - software/dgc/cdgc.git/commitdiff
Cache B_FREE pages also when marking
authorLeandro Lucarella <llucax@gmail.com>
Sun, 29 Aug 2010 02:33:13 +0000 (23:33 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Sun, 29 Aug 2010 02:33:13 +0000 (23:33 -0300)
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.

rt/gc/cdgc/gc.d

index 50018b3213e3fd5101d692e661565d277eecc11f..f70227b5bd5a29c0722594d7a270932d9ad68848 100644 (file)
@@ -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))
                 {