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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Thu Oct 22 19:38:22 UTC 2009


Author: chromatic
Date: Thu Oct 22 19:38:20 2009
New Revision: 42024
URL: https://trac.parrot.org/parrot/changeset/42024

Log:
[GC] Rearranged branches in Parrot_gc_get_attributes_from_pool() in descending
order of likelihood.  This is a modest optimization in performance and clarity.

Modified:
   trunk/src/gc/mark_sweep.c

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Thu Oct 22 13:06:06 2009	(r42023)
+++ trunk/src/gc/mark_sweep.c	Thu Oct 22 19:38:20 2009	(r42024)
@@ -995,9 +995,11 @@
     PMC_Attribute_Free_List *item;
 
 #if GC_USE_LAZY_ALLOCATOR
-    if (pool->newfree == NULL && pool->free_list == NULL)
-        Parrot_gc_allocate_new_attributes_arena(interp, pool);
-    if (pool->newfree) {
+    if (pool->free_list) {
+        item            = pool->free_list;
+        pool->free_list = item->next;
+    }
+    else if (pool->newfree) {
         item          = pool->newfree;
         pool->newfree = (PMC_Attribute_Free_List *)
                         ((char *)(pool->newfree) + pool->attr_size);
@@ -1005,8 +1007,8 @@
             pool->newfree = NULL;
     }
     else {
-        item            = pool->free_list;
-        pool->free_list = item->next;
+        Parrot_gc_allocate_new_attributes_arena(interp, pool);
+        return Parrot_gc_get_attributes_from_pool(interp, pool);
     }
 #else
     if (pool->free_list == NULL)


More information about the parrot-commits mailing list