[svn:parrot] r43776 - in branches/gc_encapsulate_part1: include/parrot src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Feb 8 12:43:49 UTC 2010


Author: bacek
Date: Mon Feb  8 12:43:46 2010
New Revision: 43776
URL: https://trac.parrot.org/parrot/changeset/43776

Log:
Make callback functions accept explicit Memory_Pools*.

Modified:
   branches/gc_encapsulate_part1/include/parrot/gc_api.h
   branches/gc_encapsulate_part1/src/gc/api.c
   branches/gc_encapsulate_part1/src/gc/gc_inf.c
   branches/gc_encapsulate_part1/src/gc/gc_ms.c
   branches/gc_encapsulate_part1/src/gc/mark_sweep.c

Modified: branches/gc_encapsulate_part1/include/parrot/gc_api.h
==============================================================================
--- branches/gc_encapsulate_part1/include/parrot/gc_api.h	Mon Feb  8 12:15:10 2010	(r43775)
+++ branches/gc_encapsulate_part1/include/parrot/gc_api.h	Mon Feb  8 12:43:46 2010	(r43776)
@@ -51,11 +51,11 @@
     GC_TRACE_SYSTEM_ONLY = 3
 } Parrot_gc_trace_type;
 
-typedef int (*pool_iter_fn)(PARROT_INTERP, struct Fixed_Size_Pool *, int, void*);
-typedef void (*add_free_object_fn_type)(PARROT_INTERP, struct Fixed_Size_Pool *, void *);
-typedef void * (*get_free_object_fn_type)(PARROT_INTERP, struct Fixed_Size_Pool *);
-typedef void (*alloc_objects_fn_type)(PARROT_INTERP, struct Fixed_Size_Pool *);
-typedef void (*gc_object_fn_type)(PARROT_INTERP, struct Fixed_Size_Pool *, PObj *);
+typedef int (*pool_iter_fn)(PARROT_INTERP, struct Memory_Pools *, struct Fixed_Size_Pool *, int, void*);
+typedef void (*add_free_object_fn_type)(PARROT_INTERP, struct Memory_Pools *, struct Fixed_Size_Pool *, void *);
+typedef void * (*get_free_object_fn_type)(PARROT_INTERP, struct Memory_Pools *, struct Fixed_Size_Pool *);
+typedef void (*alloc_objects_fn_type)(PARROT_INTERP, struct Memory_Pools *, struct Fixed_Size_Pool *);
+typedef void (*gc_object_fn_type)(PARROT_INTERP, struct Memory_Pools *, struct Fixed_Size_Pool *, PObj *);
 
 
 /* &gen_from_enum(interpinfo.pasm) prefix(INTERPINFO_) */

Modified: branches/gc_encapsulate_part1/src/gc/api.c
==============================================================================
--- branches/gc_encapsulate_part1/src/gc/api.c	Mon Feb  8 12:15:10 2010	(r43775)
+++ branches/gc_encapsulate_part1/src/gc/api.c	Mon Feb  8 12:43:46 2010	(r43776)
@@ -135,20 +135,24 @@
         FUNC_MODIFIES(*source);
 
 static int sweep_cb_buf(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool),
     SHIM(int flag),
     ARGIN(void *arg))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
-        __attribute__nonnull__(4)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(5)
         FUNC_MODIFIES(*pool);
 
 static int sweep_cb_pmc(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool),
     SHIM(int flag),
     SHIM(void *arg))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 #define ASSERT_ARGS_fix_pmc_syncs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -170,10 +174,12 @@
     , PARROT_ASSERT_ARG(source))
 #define ASSERT_ARGS_sweep_cb_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(pool) \
     , PARROT_ASSERT_ARG(arg))
 #define ASSERT_ARGS_sweep_cb_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(pool))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
@@ -388,7 +394,8 @@
     Fixed_Size_Pool * const pool = flags & PObj_constant_FLAG
             ? interp->mem_pools->constant_pmc_pool
             : interp->mem_pools->pmc_pool;
-    PMC * const pmc = (PMC *)pool->get_free_object(interp, pool);
+    PMC * const pmc = (PMC *)pool->get_free_object(interp, interp->mem_pools,
+            pool);
 
     if (!pmc)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
@@ -424,7 +431,7 @@
     Parrot_pmc_destroy(interp, pmc);
 
     PObj_flags_SETTO((PObj *)pmc, PObj_on_free_list_FLAG);
-    pool->add_free_object(interp, pool, (PObj *)pmc);
+    pool->add_free_object(interp, interp->mem_pools, pool, (PObj *)pmc);
     pool->num_free_objects++;
 }
 
@@ -532,7 +539,7 @@
     ASSERT_ARGS(Parrot_gc_free_string_header)
     if (!PObj_constant_TEST(s)) {
         Fixed_Size_Pool * const pool = interp->mem_pools->string_header_pool;
-        pool->add_free_object(interp, pool, s);
+        pool->add_free_object(interp, interp->mem_pools, pool, s);
     }
 }
 
@@ -579,7 +586,7 @@
 get_free_buffer(PARROT_INTERP, ARGIN(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(get_free_buffer)
-    return pool->get_free_object(interp, pool);
+    return pool->get_free_object(interp, interp->mem_pools, pool);
 }
 
 /*
@@ -600,7 +607,7 @@
 {
     ASSERT_ARGS(Parrot_gc_free_bufferlike_header)
     Fixed_Size_Pool * const pool = get_bufferlike_pool(interp, size);
-    pool->add_free_object(interp, pool, obj);
+    pool->add_free_object(interp, interp->mem_pools, pool, obj);
 }
 
 /*
@@ -1086,8 +1093,8 @@
 
 /*
 
-=item C<static int sweep_cb_pmc(PARROT_INTERP, Fixed_Size_Pool *pool, int flag,
-void *arg)>
+=item C<static int sweep_cb_pmc(PARROT_INTERP, Memory_Pools *mem_pools,
+Fixed_Size_Pool *pool, int flag, void *arg)>
 
 Performs a garbage collection sweep of the given pmc pool, then frees it. Calls
 C<Parrot_gc_sweep_pool> to perform the sweep, and C<free_pool> to free the pool and
@@ -1098,7 +1105,9 @@
 */
 
 static int
-sweep_cb_pmc(PARROT_INTERP, ARGMOD(Fixed_Size_Pool *pool),
+sweep_cb_pmc(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool),
         SHIM(int flag), SHIM(void *arg))
 {
     ASSERT_ARGS(sweep_cb_pmc)
@@ -1109,8 +1118,8 @@
 
 /*
 
-=item C<static int sweep_cb_buf(PARROT_INTERP, Fixed_Size_Pool *pool, int flag,
-void *arg)>
+=item C<static int sweep_cb_buf(PARROT_INTERP, Memory_Pools *mem_pools,
+Fixed_Size_Pool *pool, int flag, void *arg)>
 
 Performs a final garbage collection sweep, then frees the pool. Calls
 C<Parrot_gc_sweep_pool> to perform the sweep, and C<free_pool> to free the pool and
@@ -1121,8 +1130,10 @@
 */
 
 static int
-sweep_cb_buf(PARROT_INTERP, ARGMOD(Fixed_Size_Pool *pool), SHIM(int flag),
-        ARGIN(void *arg))
+sweep_cb_buf(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool),
+        SHIM(int flag), ARGIN(void *arg))
 {
     ASSERT_ARGS(sweep_cb_buf)
     UNUSED(arg);

Modified: branches/gc_encapsulate_part1/src/gc/gc_inf.c
==============================================================================
--- branches/gc_encapsulate_part1/src/gc/gc_inf.c	Mon Feb  8 12:15:10 2010	(r43775)
+++ branches/gc_encapsulate_part1/src/gc/gc_inf.c	Mon Feb  8 12:43:46 2010	(r43776)
@@ -38,26 +38,35 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
 static void gc_inf_add_free_object(SHIM_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool),
     ARGIN(void *to_add))
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*pool);
 
-static void gc_inf_alloc_objects(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+static void gc_inf_alloc_objects(SHIM_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
+    ARGMOD(Fixed_Size_Pool *pool))
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 PARROT_CANNOT_RETURN_NULL
 static void * gc_inf_get_free_object(SHIM_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool))
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 static void gc_inf_mark_and_sweep(SHIM_INTERP, UINTVAL flags);
 static void gc_inf_more_traceable_objects(SHIM_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool))
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 static void gc_inf_pool_init(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
@@ -65,15 +74,19 @@
         FUNC_MODIFIES(*pool);
 
 #define ASSERT_ARGS_gc_inf_add_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pool) \
+       PARROT_ASSERT_ARG(mem_pools) \
+    , PARROT_ASSERT_ARG(pool) \
     , PARROT_ASSERT_ARG(to_add))
 #define ASSERT_ARGS_gc_inf_alloc_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pool))
+       PARROT_ASSERT_ARG(mem_pools) \
+    , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_inf_get_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pool))
+       PARROT_ASSERT_ARG(mem_pools) \
+    , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_inf_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
 #define ASSERT_ARGS_gc_inf_more_traceable_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pool))
+       PARROT_ASSERT_ARG(mem_pools) \
+    , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_inf_pool_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(pool))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
@@ -111,8 +124,8 @@
 
 /*
 
-=item C<static void gc_inf_add_free_object(PARROT_INTERP, Fixed_Size_Pool *pool,
-void *to_add)>
+=item C<static void gc_inf_add_free_object(PARROT_INTERP, Memory_Pools
+*mem_pools, Fixed_Size_Pool *pool, void *to_add)>
 
 Manually frees a chunk of memory. Normally this would return the memory
 to the free list of the pool, but in this case we just return it to the
@@ -127,8 +140,10 @@
 */
 
 static void
-gc_inf_add_free_object(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool),
-    ARGIN(void *to_add))
+gc_inf_add_free_object(SHIM_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool),
+        ARGIN(void *to_add))
 {
     ASSERT_ARGS(gc_inf_add_free_object)
     if (to_add)
@@ -137,8 +152,8 @@
 
 /*
 
-=item C<static void * gc_inf_get_free_object(PARROT_INTERP, Fixed_Size_Pool
-*pool)>
+=item C<static void * gc_inf_get_free_object(PARROT_INTERP, Memory_Pools
+*mem_pools, Fixed_Size_Pool *pool)>
 
 Gets a new object from the pool. Each pool specifies an object size in
 C<pool->object_size> so we can use that number to make the allocation. For
@@ -160,7 +175,9 @@
 
 PARROT_CANNOT_RETURN_NULL
 static void *
-gc_inf_get_free_object(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+gc_inf_get_free_object(SHIM_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(gc_inf_get_free_object)
     return calloc(pool->object_size, 1);
@@ -168,7 +185,8 @@
 
 /*
 
-=item C<static void gc_inf_alloc_objects(PARROT_INTERP, Fixed_Size_Pool *pool)>
+=item C<static void gc_inf_alloc_objects(PARROT_INTERP, Memory_Pools *mem_pools,
+Fixed_Size_Pool *pool)>
 
 Allocates a new arena of objects from the system. This function is only
 really used internally by the core, the API functions don't need to call
@@ -182,7 +200,9 @@
 */
 
 static void
-gc_inf_alloc_objects(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+gc_inf_alloc_objects(SHIM_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(gc_inf_alloc_objects)
     UNUSED(pool);
@@ -190,8 +210,8 @@
 
 /*
 
-=item C<static void gc_inf_more_traceable_objects(PARROT_INTERP, Fixed_Size_Pool
-*pool)>
+=item C<static void gc_inf_more_traceable_objects(PARROT_INTERP, Memory_Pools
+*mem_pools, Fixed_Size_Pool *pool)>
 
 Would normally try to find new traceable objects by first running a GC sweep
 and then allocating a new arena from the system. Neither of these are
@@ -206,7 +226,9 @@
 */
 
 static void
-gc_inf_more_traceable_objects(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+gc_inf_more_traceable_objects(SHIM_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(gc_inf_more_traceable_objects)
     UNUSED(pool);

Modified: branches/gc_encapsulate_part1/src/gc/gc_ms.c
==============================================================================
--- branches/gc_encapsulate_part1/src/gc/gc_ms.c	Mon Feb  8 12:15:10 2010	(r43775)
+++ branches/gc_encapsulate_part1/src/gc/gc_ms.c	Mon Feb  8 12:43:46 2010	(r43776)
@@ -23,16 +23,20 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
 static void gc_ms_add_free_object(SHIM_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool),
     ARGIN(void *to_add))
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*pool);
 
 static void gc_ms_alloc_objects(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 static void gc_ms_finalize(PARROT_INTERP,
@@ -43,18 +47,22 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 static void * gc_ms_get_free_object(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 static void gc_ms_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
         __attribute__nonnull__(1);
 
 static void gc_ms_more_traceable_objects(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*pool);
 
 static void gc_ms_pool_init(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
@@ -62,12 +70,14 @@
         FUNC_MODIFIES(*pool);
 
 static int gc_ms_sweep_cb(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool),
     int flag,
     ARGMOD(void *arg))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
-        __attribute__nonnull__(4)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(5)
         FUNC_MODIFIES(*pool)
         FUNC_MODIFIES(*arg);
 
@@ -76,26 +86,31 @@
         __attribute__nonnull__(1);
 
 #define ASSERT_ARGS_gc_ms_add_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pool) \
+       PARROT_ASSERT_ARG(mem_pools) \
+    , PARROT_ASSERT_ARG(pool) \
     , PARROT_ASSERT_ARG(to_add))
 #define ASSERT_ARGS_gc_ms_alloc_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_ms_finalize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(mem_pools))
 #define ASSERT_ARGS_gc_ms_get_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_ms_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_more_traceable_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_ms_pool_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_ms_sweep_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(pool) \
     , PARROT_ASSERT_ARG(arg))
 #define ASSERT_ARGS_gc_ms_trace_active_PMCs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -262,8 +277,8 @@
 
 /*
 
-=item C<static int gc_ms_sweep_cb(PARROT_INTERP, Fixed_Size_Pool *pool, int
-flag, void *arg)>
+=item C<static int gc_ms_sweep_cb(PARROT_INTERP, Memory_Pools *mem_pools,
+Fixed_Size_Pool *pool, int flag, void *arg)>
 
 Sweeps the given pool for the MS collector. This function also ends
 the profiling timer, if profiling is enabled. Returns the total number
@@ -274,8 +289,10 @@
 */
 
 static int
-gc_ms_sweep_cb(PARROT_INTERP, ARGMOD(Fixed_Size_Pool *pool), int flag,
-    ARGMOD(void *arg))
+gc_ms_sweep_cb(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool),
+        int flag, ARGMOD(void *arg))
 {
     ASSERT_ARGS(gc_ms_sweep_cb)
     int * const total_free = (int *) arg;
@@ -317,8 +334,8 @@
 
 /*
 
-=item C<static void gc_ms_more_traceable_objects(PARROT_INTERP, Fixed_Size_Pool
-*pool)>
+=item C<static void gc_ms_more_traceable_objects(PARROT_INTERP, Memory_Pools
+*mem_pools, Fixed_Size_Pool *pool)>
 
 We're out of traceable objects. First we try a GC run to free some up. If
 that doesn't work, allocate a new arena.
@@ -328,7 +345,9 @@
 */
 
 static void
-gc_ms_more_traceable_objects(PARROT_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+gc_ms_more_traceable_objects(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(gc_ms_more_traceable_objects)
 
@@ -346,17 +365,17 @@
 #if GC_USE_LAZY_ALLOCATOR
     if ((!pool->free_list || pool->num_free_objects < pool->replenish_level)
         && !pool->newfree)
-        (*pool->alloc_objects) (interp, pool);
+        (*pool->alloc_objects) (interp, interp->mem_pools, pool);
 #else
     if (!pool->free_list || pool->num_free_objects < pool->replenish_level)
-    (*pool->alloc_objects) (interp, pool);
+    (*pool->alloc_objects) (interp, interp->mem_pools, pool);
 #endif
 }
 
 /*
 
-=item C<static void gc_ms_add_free_object(PARROT_INTERP, Fixed_Size_Pool *pool,
-void *to_add)>
+=item C<static void gc_ms_add_free_object(PARROT_INTERP, Memory_Pools
+*mem_pools, Fixed_Size_Pool *pool, void *to_add)>
 
 Add an unused object back to the pool's free list for later reuse. Set
 the PObj flags to indicate that the item is free.
@@ -366,8 +385,10 @@
 */
 
 static void
-gc_ms_add_free_object(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool),
-    ARGIN(void *to_add))
+gc_ms_add_free_object(SHIM_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool),
+        ARGIN(void *to_add))
 {
     ASSERT_ARGS(gc_ms_add_free_object)
     GC_MS_PObj_Wrapper *object = (GC_MS_PObj_Wrapper *)to_add;
@@ -380,8 +401,8 @@
 
 /*
 
-=item C<static void * gc_ms_get_free_object(PARROT_INTERP, Fixed_Size_Pool
-*pool)>
+=item C<static void * gc_ms_get_free_object(PARROT_INTERP, Memory_Pools
+*mem_pools, Fixed_Size_Pool *pool)>
 
 Free object allocator for the MS garbage collector system. If there are no
 free objects, call C<gc_ms_add_free_object> to either free them up with a
@@ -395,7 +416,9 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 static void *
-gc_ms_get_free_object(PARROT_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+gc_ms_get_free_object(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(gc_ms_get_free_object)
     PObj *ptr;
@@ -403,7 +426,7 @@
 
 #if GC_USE_LAZY_ALLOCATOR
     if (!free_list && !pool->newfree) {
-        (*pool->more_objects)(interp, pool);
+        (*pool->more_objects)(interp, mem_pools, pool);
         free_list = (PObj *)pool->free_list;
     }
 
@@ -425,7 +448,7 @@
 #else
     /* if we don't have any objects */
     if (!free_list) {
-        (*pool->more_objects)(interp, pool);
+        (*pool->more_objects)(interp, mem_pools, pool);
         free_list = (PObj *)pool->free_list;
     }
 
@@ -444,7 +467,8 @@
 
 /*
 
-=item C<static void gc_ms_alloc_objects(PARROT_INTERP, Fixed_Size_Pool *pool)>
+=item C<static void gc_ms_alloc_objects(PARROT_INTERP, Memory_Pools *mem_pools,
+Fixed_Size_Pool *pool)>
 
 New arena allocator function for the MS garbage collector system. Allocates
 and initializes a new memory arena in the given pool. Adds all the new
@@ -455,7 +479,9 @@
 */
 
 static void
-gc_ms_alloc_objects(PARROT_INTERP, ARGMOD(Fixed_Size_Pool *pool))
+gc_ms_alloc_objects(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        ARGMOD(Fixed_Size_Pool *pool))
 {
     ASSERT_ARGS(gc_ms_alloc_objects)
     /* Setup memory for the new objects */

Modified: branches/gc_encapsulate_part1/src/gc/mark_sweep.c
==============================================================================
--- branches/gc_encapsulate_part1/src/gc/mark_sweep.c	Mon Feb  8 12:15:10 2010	(r43775)
+++ branches/gc_encapsulate_part1/src/gc/mark_sweep.c	Mon Feb  8 12:43:46 2010	(r43776)
@@ -46,10 +46,12 @@
         FUNC_MODIFIES(*b);
 
 static void free_pmc_in_pool(PARROT_INTERP,
+    ARGIN(Memory_Pools *mem_pools),
     SHIM(Fixed_Size_Pool *pool),
     ARGMOD(PObj *p))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(3)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*p);
 
 PARROT_WARN_UNUSED_RESULT
@@ -92,6 +94,7 @@
        PARROT_ASSERT_ARG(b))
 #define ASSERT_ARGS_free_pmc_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(mem_pools) \
     , PARROT_ASSERT_ARG(p))
 #define ASSERT_ARGS_new_bufferlike_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
@@ -306,9 +309,9 @@
                 }
 
                 if (gc_object)
-                    gc_object(interp, pool, b);
+                    gc_object(interp, interp->mem_pools, pool, b);
 
-                pool->add_free_object(interp, pool, b);
+                pool->add_free_object(interp, interp->mem_pools, pool, b);
             }
 next:
             b = (PObj *)((char *)b + object_size);
@@ -554,8 +557,8 @@
 
 /*
 
-=item C<static void free_pmc_in_pool(PARROT_INTERP, Fixed_Size_Pool *pool, PObj
-*p)>
+=item C<static void free_pmc_in_pool(PARROT_INTERP, Memory_Pools *mem_pools,
+Fixed_Size_Pool *pool, PObj *p)>
 
 Frees a PMC that is no longer being used. Calls a custom C<destroy> VTABLE
 method if one is available.
@@ -565,7 +568,9 @@
 */
 
 static void
-free_pmc_in_pool(PARROT_INTERP, SHIM(Fixed_Size_Pool *pool),
+free_pmc_in_pool(PARROT_INTERP,
+        ARGIN(Memory_Pools *mem_pools),
+        SHIM(Fixed_Size_Pool *pool),
         ARGMOD(PObj *p))
 {
     ASSERT_ARGS(free_pmc_in_pool)
@@ -892,7 +897,7 @@
             ? mem_pools->constant_pmc_pool
             : mem_pools->pmc_pool;
 
-        const int ret_val = (func)(interp, pool,
+        const int ret_val = (func)(interp, interp->mem_pools, pool,
             flag & (POOL_PMC | POOL_CONST) , arg);
 
         if (ret_val)
@@ -903,7 +908,7 @@
         INTVAL i;
 
         if (flag & POOL_CONST) {
-            const int ret_val = (func)(interp,
+            const int ret_val = (func)(interp, interp->mem_pools,
                 mem_pools->constant_string_header_pool,
                 POOL_BUFFER | POOL_CONST, arg);
 
@@ -915,7 +920,7 @@
             Fixed_Size_Pool * const pool = mem_pools->sized_header_pools[i];
 
             if (pool) {
-                const int ret_val = (func)(interp, pool, POOL_BUFFER, arg);
+                const int ret_val = (func)(interp, interp->mem_pools, pool, POOL_BUFFER, arg);
                 if (ret_val)
                     return ret_val;
             }


More information about the parrot-commits mailing list