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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat Oct 24 07:50:51 UTC 2009


Author: chromatic
Date: Sat Oct 24 07:50:50 2009
New Revision: 42071
URL: https://trac.parrot.org/parrot/changeset/42071

Log:
[GC] Moved Parrot_gc_free_attributes_from_pool() into src/gc/api.c and made it
a static function, so an optimizing compiler can inline it.  This gives a
modest (1.656%) performance improvement to fib.pir.

Modified:
   trunk/src/gc/api.c
   trunk/src/gc/gc_private.h
   trunk/src/gc/mark_sweep.c

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Sat Oct 24 07:50:43 2009	(r42070)
+++ trunk/src/gc/api.c	Sat Oct 24 07:50:50 2009	(r42071)
@@ -116,6 +116,15 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
+static void Parrot_gc_free_attributes_from_pool(PARROT_INTERP,
+    ARGMOD(PMC_Attribute_Pool *pool),
+    ARGMOD(void *data))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        FUNC_MODIFIES(*pool)
+        FUNC_MODIFIES(*data);
+
 static void Parrot_gc_merge_buffer_pools(PARROT_INTERP,
     ARGMOD(Fixed_Size_Pool *dest),
     ARGMOD(Fixed_Size_Pool *source))
@@ -150,6 +159,11 @@
 #define ASSERT_ARGS_get_free_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_Parrot_gc_free_attributes_from_pool \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(pool) \
+    , PARROT_ASSERT_ARG(data))
 #define ASSERT_ARGS_Parrot_gc_merge_buffer_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(dest) \
@@ -314,14 +328,15 @@
     ASSERT_ARGS(Parrot_gc_initialize)
 
     interp->mem_pools = mem_allocate_zeroed_typed(Memory_Pools);
-    interp->mem_pools->num_sized = 0;
-    interp->mem_pools->num_attribs = 0;
-    interp->mem_pools->attrib_pools = NULL;
+    interp->gc_sys    = mem_allocate_zeroed_typed(GC_Subsystem);
+
+    interp->mem_pools->num_sized          = 0;
+    interp->mem_pools->num_attribs        = 0;
+    interp->mem_pools->attrib_pools       = NULL;
     interp->mem_pools->sized_header_pools = NULL;
 
-    interp->lo_var_ptr                     = stacktop;
+    interp->lo_var_ptr                    = stacktop;
 
-    interp->gc_sys = mem_allocate_zeroed_typed(GC_Subsystem);
 
     /*TODO: add ability to specify GC core at command line w/ --gc= */
     if (0) /*If they chose sys_type with the --gc command line switch,*/
@@ -1707,6 +1722,29 @@
     Parrot_gc_free_attributes_from_pool(interp, pools[idx], data);
 }
 
+
+/*
+
+=item C<static void Parrot_gc_free_attributes_from_pool(PARROT_INTERP,
+PMC_Attribute_Pool *pool, void *data)>
+
+Frees a fixed-size data item back to the pool for later reallocation.  Private
+to this file.
+
+*/
+
+static void
+Parrot_gc_free_attributes_from_pool(PARROT_INTERP,
+    ARGMOD(PMC_Attribute_Pool *pool),
+    ARGMOD(void *data))
+{
+    ASSERT_ARGS(Parrot_gc_free_attributes_from_pool)
+    PMC_Attribute_Free_List * const item = (PMC_Attribute_Free_List *)data;
+    item->next = pool->free_list;
+    pool->free_list = item;
+    pool->num_free_objects++;
+}
+
 /*
 
 =back

Modified: trunk/src/gc/gc_private.h
==============================================================================
--- trunk/src/gc/gc_private.h	Sat Oct 24 07:50:43 2009	(r42070)
+++ trunk/src/gc/gc_private.h	Sat Oct 24 07:50:50 2009	(r42071)
@@ -326,15 +326,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-void Parrot_gc_free_attributes_from_pool(PARROT_INTERP,
-    ARGMOD(PMC_Attribute_Pool * pool),
-    ARGMOD(void *data))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(* pool)
-        FUNC_MODIFIES(*data);
-
 PARROT_CANNOT_RETURN_NULL
 PMC_Attribute_Pool * Parrot_gc_get_attribute_pool(PARROT_INTERP,
     size_t attrib_size)
@@ -387,11 +378,6 @@
 #define ASSERT_ARGS_Parrot_gc_clear_live_bits __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pool))
-#define ASSERT_ARGS_Parrot_gc_free_attributes_from_pool \
-     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(pool) \
-    , PARROT_ASSERT_ARG(data))
 #define ASSERT_ARGS_Parrot_gc_get_attribute_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_gc_get_attributes_from_pool \

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Sat Oct 24 07:50:43 2009	(r42070)
+++ trunk/src/gc/mark_sweep.c	Sat Oct 24 07:50:50 2009	(r42071)
@@ -960,11 +960,6 @@
 
 Allocate a new arena of fixed-sized data structures for the given pool.
 
-=item C<void Parrot_gc_free_attributes_from_pool(PARROT_INTERP,
-PMC_Attribute_Pool * pool, void *data)>
-
-Frees a fixed-size data item back to the pool for later reallocation
-
 =item C<void Parrot_gc_initialize_fixed_size_pools(PARROT_INTERP, size_t
 init_num_pools)>
 
@@ -1021,17 +1016,6 @@
     return (void *)item;
 }
 
-void
-Parrot_gc_free_attributes_from_pool(PARROT_INTERP, ARGMOD(PMC_Attribute_Pool * pool),
-    ARGMOD(void *data))
-{
-    ASSERT_ARGS(Parrot_gc_free_attributes_from_pool)
-    PMC_Attribute_Free_List * const item = (PMC_Attribute_Free_List *)data;
-    item->next = pool->free_list;
-    pool->free_list = item;
-    pool->num_free_objects++;
-}
-
 
 static void
 Parrot_gc_allocate_new_attributes_arena(PARROT_INTERP, ARGMOD(PMC_Attribute_Pool *pool))


More information about the parrot-commits mailing list