[svn:parrot] r42936 - in trunk: include/parrot src src/gc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Dec 8 05:15:41 UTC 2009


Author: chromatic
Date: Tue Dec  8 05:15:36 2009
New Revision: 42936
URL: https://trac.parrot.org/parrot/changeset/42936

Log:
[PMC] Added macro to clear all PMC GC flags in Parrot_pmc_destroy().  This
actually improves performance by 0.755% on the fib.pir NQP benchmark, though
admittedly we should memset the PMC header to 0....

Modified:
   trunk/include/parrot/pobj.h
   trunk/src/gc/api.c
   trunk/src/pmc.c

Modified: trunk/include/parrot/pobj.h
==============================================================================
--- trunk/include/parrot/pobj.h	Tue Dec  8 02:20:08 2009	(r42935)
+++ trunk/include/parrot/pobj.h	Tue Dec  8 05:15:36 2009	(r42936)
@@ -326,6 +326,11 @@
         PObj_custom_destroy_SET(o); \
 } while (0)
 
+#define PObj_gc_CLEAR(o) (PObj_get_FLAGS(o) \
+    &= ~PObj_custom_destroy_FLAG \
+     | ~PObj_custom_mark_FLAG \
+     | ~PObj_live_FLAG)
+
 /*******************************************************
  * DEPRECATED -- use PObj_custom_destroy_FOO() instead *
  *******************************************************/

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Tue Dec  8 02:20:08 2009	(r42935)
+++ trunk/src/gc/api.c	Tue Dec  8 05:15:36 2009	(r42936)
@@ -1733,8 +1733,10 @@
 {
     ASSERT_ARGS(Parrot_gc_free_attributes_from_pool)
     PMC_Attribute_Free_List * const item = (PMC_Attribute_Free_List *)data;
-    item->next = pool->free_list;
+
+    item->next      = pool->free_list;
     pool->free_list = item;
+
     pool->num_free_objects++;
 }
 

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c	Tue Dec  8 02:20:08 2009	(r42935)
+++ trunk/src/pmc.c	Tue Dec  8 05:15:36 2009	(r42936)
@@ -112,14 +112,10 @@
 {
     ASSERT_ARGS(Parrot_pmc_destroy)
 
-    if (PObj_custom_destroy_TEST(pmc)) {
+    if (PObj_custom_destroy_TEST(pmc))
         VTABLE_destroy(interp, pmc);
-        /* Prevent repeated calls. */
-        PObj_custom_destroy_CLEAR(pmc);
-    }
 
-    PObj_custom_mark_CLEAR(pmc);
-    PObj_live_CLEAR(pmc);
+    PObj_gc_CLEAR(pmc);
 
     if (PObj_is_PMC_shared_TEST(pmc) && PMC_sync(pmc))
         Parrot_gc_free_pmc_sync(interp, pmc);


More information about the parrot-commits mailing list