[svn:parrot] r43748 - branches/gc_encapsulate/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Feb 7 07:53:06 UTC 2010


Author: bacek
Date: Sun Feb  7 07:53:05 2010
New Revision: 43748
URL: https://trac.parrot.org/parrot/changeset/43748

Log:
Expose compating of string pool via GC_Subsystem.

Modified:
   branches/gc_encapsulate/src/gc/api.c
   branches/gc_encapsulate/src/gc/gc_ms.c
   branches/gc_encapsulate/src/gc/gc_private.h

Modified: branches/gc_encapsulate/src/gc/api.c
==============================================================================
--- branches/gc_encapsulate/src/gc/api.c	Sun Feb  7 07:52:44 2010	(r43747)
+++ branches/gc_encapsulate/src/gc/api.c	Sun Feb  7 07:53:05 2010	(r43748)
@@ -736,7 +736,7 @@
 Parrot_gc_compact_memory_pool(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_gc_compact_memory_pool)
-    // XXX compact_pool(interp, interp->mem_pools->memory_pool);
+    interp->gc_sys->do_compact(interp);
 }
 
 /*

Modified: branches/gc_encapsulate/src/gc/gc_ms.c
==============================================================================
--- branches/gc_encapsulate/src/gc/gc_ms.c	Sun Feb  7 07:52:44 2010	(r43747)
+++ branches/gc_encapsulate/src/gc/gc_ms.c	Sun Feb  7 07:53:05 2010	(r43748)
@@ -72,6 +72,9 @@
 static void gc_ms_block_gc_sweep(PARROT_INTERP)
         __attribute__nonnull__(1);
 
+static void gc_ms_compact(PARROT_INTERP)
+        __attribute__nonnull__(1);
+
 static void gc_ms_finalize(PARROT_INTERP,
     ARGIN(Memory_Pools * const mem_pools))
         __attribute__nonnull__(1)
@@ -188,6 +191,8 @@
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_block_gc_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_compact __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_finalize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(mem_pools))
@@ -264,9 +269,11 @@
     GC_Subsystem *gc = interp->gc_sys;
 
     gc->init_child_interp  = gc_ms_init_child_inter;
-    gc->do_gc_mark         = gc_ms_mark_and_sweep;
     gc->finalize_gc_system = NULL;
 
+    gc->do_gc_mark         = gc_ms_mark_and_sweep;
+    gc->do_compact         = gc_ms_compact;
+
     gc->allocate_pmc_header     = gc_ms_allocate_pmc_header;
     gc->free_pmc_header         = gc_ms_free_pmc_header;
     gc->allocate_string_header  = gc_ms_allocate_string_header;
@@ -418,6 +425,25 @@
 
 /*
 
+=item C<static void gc_ms_compact(PARROT_INTERP)>
+
+Compact string pool.
+
+=cut
+
+*/
+
+static void
+gc_ms_compact(PARROT_INTERP)
+{
+    ASSERT_ARGS(gc_ms_compact)
+    Memory_Pools * const mem_pools = (Memory_Pools*)interp->gc_sys->gc_private;
+    compact_pool(interp, mem_pools, mem_pools->memory_pool);
+    return;
+}
+
+/*
+
 =item C<static PMC* gc_ms_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)>
 
 =item C<static void gc_ms_free_pmc_header(PARROT_INTERP, PMC *pmc)>

Modified: branches/gc_encapsulate/src/gc/gc_private.h
==============================================================================
--- branches/gc_encapsulate/src/gc/gc_private.h	Sun Feb  7 07:52:44 2010	(r43747)
+++ branches/gc_encapsulate/src/gc/gc_private.h	Sun Feb  7 07:53:05 2010	(r43748)
@@ -108,6 +108,9 @@
     /* Run GC "mark" explicitely */
     void (*do_gc_mark)(PARROT_INTERP, UINTVAL flags);
 
+    /* Compact string pool */
+    void (*do_compact)(PARROT_INTERP);
+
     /* Allocation functions with explicit freeing counterparts */
     PMC*    (*allocate_pmc_header)(PARROT_INTERP, UINTVAL flags);
     void    (*free_pmc_header)(PARROT_INTERP, PMC *pmc);


More information about the parrot-commits mailing list