[svn:parrot] r39678 - in trunk/src: . gc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sat Jun 20 20:54:08 UTC 2009


Author: whiteknight
Date: Sat Jun 20 20:54:07 2009
New Revision: 39678
URL: https://trac.parrot.org/parrot/changeset/39678

Log:
[pmc] now that we're sanely checking for existing pmc_exts in the GC, we can remove some checks elsewhere

Modified:
   trunk/src/gc/api.c
   trunk/src/pmc.c

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Sat Jun 20 20:40:38 2009	(r39677)
+++ trunk/src/gc/api.c	Sat Jun 20 20:54:07 2009	(r39678)
@@ -363,17 +363,16 @@
     Arenas            * const arena_base = interp->arena_base;
     Small_Object_Pool * const ext_pool   = arena_base->pmc_ext_pool;
 
+    if (!p->pmc_ext)
+        return;
+
     if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) {
         MUTEX_DESTROY(PMC_sync(p)->pmc_lock);
         mem_internal_free(PMC_sync(p));
         PMC_sync(p) = NULL;
     }
-
-    if (p->pmc_ext) {
-        ext_pool->add_free_object(interp, ext_pool, p->pmc_ext);
-        ext_pool->num_free_objects++;
-    }
-
+    ext_pool->add_free_object(interp, ext_pool, p->pmc_ext);
+    ext_pool->num_free_objects++;
     p->pmc_ext = NULL;
 }
 

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c	Sat Jun 20 20:40:38 2009	(r39677)
+++ trunk/src/pmc.c	Sat Jun 20 20:54:07 2009	(r39678)
@@ -298,16 +298,13 @@
     /* Do we need one? */
     if (flags & VTABLE_PMC_NEEDS_EXT) {
         /* If we need an ext area, go allocate one */
-        if (!has_ext)
-            Parrot_gc_add_pmc_ext(interp, pmc);
+        Parrot_gc_add_pmc_ext(interp, pmc);
         newflags |= PObj_is_PMC_EXT_FLAG;
         PARROT_ASSERT(pmc->pmc_ext != NULL);
         PARROT_ASSERT((newflags & PObj_is_PMC_EXT_FLAG) != 0);
     }
     else {
-        if (has_ext)
-            Parrot_gc_free_pmc_ext(interp, pmc);
-        pmc->pmc_ext = NULL;
+        Parrot_gc_free_pmc_ext(interp, pmc);
         PMC_data(pmc) = NULL;
         newflags &= ~PObj_is_PMC_EXT_FLAG;
         PARROT_ASSERT((newflags & PObj_is_PMC_EXT_FLAG) == 0);


More information about the parrot-commits mailing list