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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sat Aug 29 16:08:03 UTC 2009


Author: NotFound
Date: Sat Aug 29 16:08:02 2009
New Revision: 40851
URL: https://trac.parrot.org/parrot/changeset/40851

Log:
[core] more refactoring of pmc destruction

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

Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h	Sat Aug 29 06:43:55 2009	(r40850)
+++ trunk/include/parrot/pmc.h	Sat Aug 29 16:08:02 2009	(r40851)
@@ -54,9 +54,10 @@
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
-void Parrot_pmc_destroy(PARROT_INTERP, ARGIN(PMC *pmc))
+void Parrot_pmc_destroy(PARROT_INTERP, ARGMOD(PMC *pmc))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(2)
+        FUNC_MODIFIES(*pmc);
 
 PARROT_EXPORT
 INTVAL PMC_is_null(SHIM_INTERP, ARGIN_NULLOK(const PMC *pmc));

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Sat Aug 29 06:43:55 2009	(r40850)
+++ trunk/src/gc/api.c	Sat Aug 29 16:08:02 2009	(r40851)
@@ -361,20 +361,7 @@
     Small_Object_Pool * const pool = (PObj_constant_TEST(pmc)) ?
         interp->arena_base->constant_pmc_pool : interp->arena_base->pmc_pool;
 
-    if (PObj_active_destroy_TEST(pmc))
-        VTABLE_destroy(interp, pmc);
-
-    Parrot_gc_free_pmc_sync(interp, pmc);
-    if (PMC_data(pmc) && pmc->vtable->attr_size) {
-#if GC_USE_FIXED_SIZE_ALLOCATOR
-        Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
-#else
-        mem_sys_free(PMC_data(pmc));
-        PMC_data(pmc) = NULL;
-#endif
-    }
-    PARROT_ASSERT(NULL == PMC_data(pmc));
-
+    Parrot_pmc_destroy(interp, pmc);
 
     PObj_flags_SETTO((PObj *)pmc, PObj_on_free_list_FLAG);
     pool->add_free_object(interp, pool, (PObj *)pmc);

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c	Sat Aug 29 06:43:55 2009	(r40850)
+++ trunk/src/pmc.c	Sat Aug 29 16:08:02 2009	(r40851)
@@ -105,7 +105,7 @@
 
 PARROT_EXPORT
 void
-Parrot_pmc_destroy(PARROT_INTERP, ARGIN(PMC *pmc))
+Parrot_pmc_destroy(PARROT_INTERP, ARGMOD(PMC *pmc))
 {
     ASSERT_ARGS(Parrot_pmc_destroy)
 
@@ -115,6 +115,8 @@
         PObj_active_destroy_CLEAR(pmc);
     }
 
+    Parrot_gc_free_pmc_sync(interp, pmc);
+
     if (pmc->vtable->attr_size) {
         if (PMC_data(pmc)) {
 #if GC_USE_FIXED_SIZE_ALLOCATOR


More information about the parrot-commits mailing list