[svn:parrot] r38549 - branches/gc_api/src/gc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Thu May 7 22:54:59 UTC 2009


Author: whiteknight
Date: Thu May  7 22:54:59 2009
New Revision: 38549
URL: https://trac.parrot.org/parrot/changeset/38549

Log:
[gc_api] Add some comments about how to eventually allocate Sync objects from the memory pools. Uncommenting those things causes a segfault, but I'm not dealing with that right now.

Modified:
   branches/gc_api/src/gc/api.c
   branches/gc_api/src/gc/pools.c

Modified: branches/gc_api/src/gc/api.c
==============================================================================
--- branches/gc_api/src/gc/api.c	Thu May  7 22:45:40 2009	(r38548)
+++ branches/gc_api/src/gc/api.c	Thu May  7 22:54:59 2009	(r38549)
@@ -173,7 +173,10 @@
     ASSERT_ARGS(Parrot_gc_add_pmc_sync)
     if (!PObj_is_PMC_EXT_TEST(pmc))
         Parrot_gc_add_pmc_ext(interp, pmc);
-    PMC_sync(pmc)        = mem_allocate_typed(Sync);
+    /* Would like to be able to do this, instead of allocating directly from
+       the OS. Causes a segfault that hasn't been figured out yet. */
+    /* PMC_sync(pmc) = (Sync *)new_bufferlike_header(interp, sizeof(Sync)); */
+    PMC_sync(pmc) = mem_allocate_typed(Sync);
     if(!PMC_sync(pmc))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
             "Parrot VM: PMC allocation failed!\n");
@@ -318,8 +321,10 @@
     Small_Object_Pool * const ext_pool   = arena_base->pmc_ext_pool;
 
     if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) {
+        /* Small_Object_Pool * pool = get_bufferlike_pool(interp, sizeof(Sync)); */
         MUTEX_DESTROY(PMC_sync(p)->pmc_lock);
         mem_internal_free(PMC_sync(p));
+        /* pool->add_free_object(interp, pool, PMC_sync(p)); */
         PMC_sync(p) = NULL;
     }
 

Modified: branches/gc_api/src/gc/pools.c
==============================================================================
--- branches/gc_api/src/gc/pools.c	Thu May  7 22:45:40 2009	(r38548)
+++ branches/gc_api/src/gc/pools.c	Thu May  7 22:54:59 2009	(r38549)
@@ -817,7 +817,7 @@
         if (i >= dest_arena->num_sized
         || !dest_arena->sized_header_pools[i]) {
             Small_Object_Pool *ignored = get_bufferlike_pool(dest_interp,
-                    i * sizeof (void *) + sizeof (Buffer));
+                    i * sizeof (void *));
             UNUSED(ignored);
             PARROT_ASSERT(dest_arena->sized_header_pools[i]);
         }


More information about the parrot-commits mailing list