[svn:parrot] r48880 - trunk/src/gc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Thu Sep 9 07:14:58 UTC 2010


Author: chromatic
Date: Thu Sep  9 07:14:58 2010
New Revision: 48880
URL: https://trac.parrot.org/parrot/changeset/48880

Log:
[GC] Sprinkled consts in Parrot_gc_sweep_pool().

This lets a good optimizing compiler avoid unnecessary memory fetches in a very
hot path.

Modified:
   trunk/src/gc/mark_sweep.c

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Thu Sep  9 06:36:19 2010	(r48879)
+++ trunk/src/gc/mark_sweep.c	Thu Sep  9 07:14:58 2010	(r48880)
@@ -257,10 +257,12 @@
 
     PObj               *b;
     Fixed_Size_Arena   *cur_arena;
-    gc_object_fn_type   gc_object   = pool->gc_object;
     UINTVAL             total_used  = 0;
     const UINTVAL       object_size = pool->object_size;
 
+    const gc_object_fn_type       gc_object       = pool->gc_object;
+    const add_free_object_fn_type add_free_object = pool->add_free_object;
+
     /* Run through all the PObj header pools and mark */
     for (cur_arena = pool->last_Arena; cur_arena; cur_arena = cur_arena->prev) {
         const size_t objects_end = cur_arena->used;
@@ -297,7 +299,7 @@
                 if (gc_object)
                     gc_object(interp, mem_pools, pool, b);
 
-                pool->add_free_object(interp, mem_pools, pool, b);
+                add_free_object(interp, mem_pools, pool, b);
             }
 next:
             b = (PObj *)((char *)b + object_size);


More information about the parrot-commits mailing list