develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35455 - trunk/src/gc

From:
infinoid
Date:
January 12, 2009 12:03
Subject:
[svn:parrot] r35455 - trunk/src/gc
Message ID:
20090112200256.4E5DBCB9FA@x12.develooper.com
Author: infinoid
Date: Mon Jan 12 12:02:55 2009
New Revision: 35455

Modified:
   trunk/src/gc/api.c
   trunk/src/gc/generational_ms.c
   trunk/src/gc/incremental_ms.c
   trunk/src/gc/mark_sweep.c

Log:
[cage] Tag some GC functions with ASSERT_ARGS().

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	(original)
+++ trunk/src/gc/api.c	Mon Jan 12 12:02:55 2009
@@ -285,6 +285,7 @@
 Parrot_gc_free_pmc(PARROT_INTERP, SHIM(Small_Object_Pool *pool),
         ARGMOD(PObj *p))
 {
+    ASSERT_ARGS(Parrot_gc_free_pmc)
     PMC    * const pmc        = (PMC *)p;
     Arenas * const arena_base = interp->arena_base;
 
@@ -321,6 +322,7 @@
 void
 Parrot_gc_free_pmc_ext(PARROT_INTERP, ARGMOD(PMC *p))
 {
+    ASSERT_ARGS(Parrot_gc_free_pmc_ext)
     /* if the PMC has a PMC_EXT structure, return it to the pool/arena */
     Arenas            * const arena_base = interp->arena_base;
     Small_Object_Pool * const ext_pool   = arena_base->pmc_ext_pool;
@@ -354,6 +356,7 @@
 Parrot_gc_free_sysmem(SHIM_INTERP, SHIM(Small_Object_Pool *pool),
         ARGMOD(PObj *b))
 {
+    ASSERT_ARGS(Parrot_gc_free_sysmem)
     /* has sysmem allocated, e.g. string_pin */
     if (PObj_sysmem_TEST(b) && PObj_bufstart(b))
         mem_sys_free(PObj_bufstart(b));
@@ -378,6 +381,7 @@
 Parrot_gc_free_buffer_malloc(SHIM_INTERP, SHIM(Small_Object_Pool *pool),
         ARGMOD(PObj *b))
 {
+    ASSERT_ARGS(Parrot_gc_free_buffer_malloc)
     /* free allocated space at (int *)bufstart - 1, but not if it used COW or is
      * external */
     PObj_buflen(b) = 0;
@@ -410,6 +414,7 @@
 void
 Parrot_gc_free_buffer(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGMOD(PObj *b))
 {
+    ASSERT_ARGS(Parrot_gc_free_buffer)
     Memory_Pool * const mem_pool = (Memory_Pool *)pool->mem_pool;
 
     /* XXX Jarkko reported that on irix pool->mem_pool was NULL, which really
@@ -441,6 +446,7 @@
 static size_t
 find_common_mask(PARROT_INTERP, size_t val1, size_t val2)
 {
+    ASSERT_ARGS(find_common_mask)
     int       i;
     const int bound = sizeof (size_t) * 8;
 
@@ -480,6 +486,7 @@
 void
 trace_mem_block(PARROT_INTERP, size_t lo_var_ptr, size_t hi_var_ptr)
 {
+    ASSERT_ARGS(trace_mem_block)
     size_t    prefix;
     ptrdiff_t cur_var_ptr;
 
@@ -549,6 +556,7 @@
 void
 Parrot_gc_profile_start(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_profile_start)
     if (Interp_flags_TEST(interp, PARROT_PROFILE_FLAG))
         interp->profile->dod_time = Parrot_floatval_time();
 }
@@ -567,6 +575,7 @@
 void
 Parrot_gc_profile_end(PARROT_INTERP, int what)
 {
+    ASSERT_ARGS(Parrot_gc_profile_end)
     if (Interp_flags_TEST(interp, PARROT_PROFILE_FLAG)) {
         RunProfile * const profile = interp->profile;
         const FLOATVAL     now     = Parrot_floatval_time();
@@ -601,6 +610,7 @@
 void
 Parrot_gc_ms_run_init(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_ms_run_init)
     Arenas * const arena_base       = interp->arena_base;
 
     arena_base->dod_trace_ptr       = NULL;
@@ -624,6 +634,7 @@
 void
 Parrot_do_dod_run(PARROT_INTERP, UINTVAL flags)
 {
+    ASSERT_ARGS(Parrot_do_dod_run)
     interp->arena_base->do_gc_mark(interp, flags);
     parrot_gc_context(interp);
 }

Modified: trunk/src/gc/generational_ms.c
==============================================================================
--- trunk/src/gc/generational_ms.c	(original)
+++ trunk/src/gc/generational_ms.c	Mon Jan 12 12:02:55 2009
@@ -562,6 +562,7 @@
 void
 Parrot_gc_gms_init(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_gms_init)
     Arenas * const arena_base = interp->arena_base;
 
     arena_base->gc_private = mem_sys_allocate_zeroed(sizeof (Gc_gms_private));
@@ -1066,6 +1067,7 @@
 parrot_gc_gms_wb(PARROT_INTERP, ARGIN(PMC *agg), ARGIN(void *old),
     ARGIN(void *_new))
 {
+    ASSERT_ARGS(parrot_gc_gms_wb)
     Gc_gms_hdr * const nh = PObj_to_GMSH(_new);
     Gc_gms_hdr * const ah = PObj_to_GMSH(agg);
 
@@ -1099,6 +1101,7 @@
 parrot_gc_gms_wb_key(PARROT_INTERP, ARGIN(PMC *agg), ARGIN(void *old),
     ARGIN(void *old_key), ARGIN(void *_new), ARGIN(void *new_key))
 {
+    ASSERT_ARGS(parrot_gc_gms_wb_key)
     Gc_gms_hdr *nh, *ah;
 
     /* handle hash values */
@@ -1469,6 +1472,7 @@
 void
 parrot_gc_gms_pobject_lives(PARROT_INTERP, ARGMOD(PObj *obj))
 {
+    ASSERT_ARGS(parrot_gc_gms_pobject_lives)
     Gc_gms_hdr *h;
     int priority;
 

Modified: trunk/src/gc/incremental_ms.c
==============================================================================
--- trunk/src/gc/incremental_ms.c	(original)
+++ trunk/src/gc/incremental_ms.c	Mon Jan 12 12:02:55 2009
@@ -521,6 +521,7 @@
 static void
 gc_ims_add_free_object(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), ARGOUT(void *to_add))
 {
+    ASSERT_ARGS(gc_ims_add_free_object)
     *(void **)to_add = pool->free_list;
     pool->free_list  = to_add;
 #if DISABLE_GC_DEBUG
@@ -550,6 +551,7 @@
 static void *
 gc_ims_get_free_object(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ims_get_free_object)
     PObj *ptr;
     Arenas * const arena_base    = interp->arena_base;
     Gc_ims_private * const g_ims = (Gc_ims_private *)arena_base->gc_private;
@@ -590,6 +592,7 @@
 static void
 gc_ims_alloc_objects(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ims_alloc_objects)
     Small_Object_Arena *new_arena;
     size_t size;
 
@@ -620,6 +623,7 @@
 static void
 gc_ims_pool_init(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ims_pool_init)
     pool->add_free_object = gc_ims_add_free_object;
     pool->get_free_object = gc_ims_get_free_object;
     pool->alloc_objects   = gc_ims_alloc_objects;
@@ -640,6 +644,7 @@
 static void
 parrot_gc_ims_deinit(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_gc_ims_deinit)
     Arenas * const arena_base = interp->arena_base;
 
     mem_sys_free(arena_base->gc_private);
@@ -663,6 +668,7 @@
 void
 Parrot_gc_ims_init(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_ims_init)
     Arenas * const arena_base = interp->arena_base;
     arena_base->gc_private    = mem_allocate_zeroed_typed(Gc_ims_private);
 
@@ -690,6 +696,7 @@
 static void
 parrot_gc_ims_reinit(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_gc_ims_reinit)
     Gc_ims_private *g_ims;
     Arenas * const  arena_base = interp->arena_base;
 
@@ -724,6 +731,7 @@
 static void
 parrot_gc_ims_mark(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_gc_ims_mark)
     size_t todo;
     double work_factor;
     PMC   *next;
@@ -763,6 +771,7 @@
 static int
 sweep_cb(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), int flag, ARGIN(void *arg))
 {
+    ASSERT_ARGS(sweep_cb)
     int * const n_obj = (int *)arg;
 
     Parrot_gc_sweep(interp, pool);
@@ -791,6 +800,7 @@
 static void
 parrot_gc_ims_sweep(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_gc_ims_sweep)
     Arenas * const  arena_base = interp->arena_base;
     Gc_ims_private *g_ims      = (Gc_ims_private *)arena_base->gc_private;
     size_t          n_objects;
@@ -841,6 +851,7 @@
 static int
 collect_cb(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), SHIM(int flag), ARGIN(void *arg))
 {
+    ASSERT_ARGS(collect_cb)
     const int           check_only = (int)(INTVAL)arg;
     Memory_Pool * const mem_pool   = pool->mem_pool;
 
@@ -888,6 +899,7 @@
 static int
 parrot_gc_ims_collect(PARROT_INTERP, int check_only)
 {
+    ASSERT_ARGS(parrot_gc_ims_collect)
 #if defined(GC_IS_MALLOC) && GC_IS_MALLOC
     UNUSED(interp);
     UNUSED(check_only);
@@ -933,6 +945,7 @@
 static void
 parrot_gc_ims_run_increment(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_gc_ims_run_increment)
     Arenas * const arena_base    = interp->arena_base;
     Gc_ims_private * const g_ims = (Gc_ims_private *)arena_base->gc_private;
 
@@ -1012,6 +1025,7 @@
 static void
 parrot_gc_ims_run(PARROT_INTERP, UINTVAL flags)
 {
+    ASSERT_ARGS(parrot_gc_ims_run)
     int                    lazy;
     Arenas * const         arena_base = interp->arena_base;
     Gc_ims_private * const g_ims      = (Gc_ims_private *)arena_base->gc_private;
@@ -1115,6 +1129,7 @@
 void
 Parrot_gc_ims_wb(PARROT_INTERP, ARGMOD(PMC *agg), ARGMOD(PMC *_new))
 {
+    ASSERT_ARGS(Parrot_gc_ims_wb)
 #if DOD_IMS_GREY_NEW
     IMS_DEBUG((stderr, "%d agg %p mark %p\n",
                 ((Gc_ims_private *)interp->arena_base->

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	(original)
+++ trunk/src/gc/mark_sweep.c	Mon Jan 12 12:02:55 2009
@@ -150,6 +150,7 @@
 void
 Parrot_gc_ms_run(PARROT_INTERP, UINTVAL flags)
 {
+    ASSERT_ARGS(Parrot_gc_ms_run)
     Arenas * const arena_base = interp->arena_base;
 
     /* XXX these should go into the interpreter */
@@ -273,6 +274,7 @@
 int
 Parrot_gc_trace_root(PARROT_INTERP, Parrot_gc_trace_type trace)
 {
+    ASSERT_ARGS(Parrot_gc_trace_root)
     Arenas           * const arena_base = interp->arena_base;
     Parrot_Context   *ctx;
     PObj             *obj;
@@ -384,6 +386,7 @@
 void
 Parrot_gc_sweep(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(Parrot_gc_sweep)
     UINTVAL total_used        = 0;
     const UINTVAL object_size = pool->object_size;
 
@@ -477,7 +480,7 @@
 void
 pobject_lives(PARROT_INTERP, ARGMOD(PObj *obj))
 {
-    PARROT_ASSERT(obj);
+    ASSERT_ARGS(pobject_lives)
 #if PARROT_GC_GMS
     do {
         if (!PObj_live_TEST(obj) && \
@@ -537,6 +540,7 @@
 INTVAL
 contained_in_pool(ARGIN(const Small_Object_Pool *pool), ARGIN(const void *ptr))
 {
+    ASSERT_ARGS(contained_in_pool)
     const Small_Object_Arena *arena;
 
     ptr = PObj_to_ARENA(ptr);
@@ -568,6 +572,7 @@
 int
 Parrot_is_const_pmc(PARROT_INTERP, ARGIN(const PMC *pmc))
 {
+    ASSERT_ARGS(Parrot_is_const_pmc)
     Small_Object_Pool * const pool = interp->arena_base->constant_pmc_pool;
     const               int   c    = contained_in_pool(pool, pmc);
 
@@ -597,6 +602,7 @@
 static void
 mark_special(PARROT_INTERP, ARGIN(PMC *obj))
 {
+    ASSERT_ARGS(mark_special)
     int     hi_prio;
     Arenas *arena_base;
 
@@ -687,6 +693,7 @@
 static void
 more_traceable_objects(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(more_traceable_objects)
     if (pool->skip)
         pool->skip = 0;
     else {
@@ -720,6 +727,7 @@
 static void
 gc_ms_add_free_pmc_ext(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGIN(void *to_add))
 {
+    ASSERT_ARGS(gc_ms_add_free_pmc_ext)
     PMC_EXT *object        = (PMC_EXT *)to_add;
     object->_metadata      = NULL;
 
@@ -742,6 +750,7 @@
 static void
 gc_ms_add_free_object(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGIN(void *to_add))
 {
+    ASSERT_ARGS(gc_ms_add_free_object)
     PObj *object           = (PObj *)to_add;
 
     PObj_flags_SETTO(object, PObj_on_free_list_FLAG);
@@ -771,6 +780,7 @@
 static void *
 gc_ms_get_free_object(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ms_get_free_object)
     PObj *ptr;
     PObj *free_list = (PObj *)pool->free_list;
 
@@ -806,6 +816,7 @@
 static void *
 gc_ms_get_free_pmc_ext(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ms_get_free_pmc_ext)
     PMC_EXT *ptr;
     PMC_EXT *free_list = (PMC_EXT *)pool->free_list;
 
@@ -841,6 +852,7 @@
 sweep_cb(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), int flag,
     ARGMOD(void *arg))
 {
+    ASSERT_ARGS(sweep_cb)
     int * const total_free = (int *) arg;
 
     Parrot_gc_sweep(interp, pool);
@@ -869,6 +881,7 @@
 static int
 trace_active_PMCs(PARROT_INTERP, Parrot_gc_trace_type trace)
 {
+    ASSERT_ARGS(trace_active_PMCs)
     if (!Parrot_gc_trace_root(interp, trace))
         return 0;
 
@@ -892,6 +905,7 @@
 static void
 clear_live_bits(ARGIN(const Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(clear_live_bits)
     Small_Object_Arena *arena;
     const UINTVAL object_size = pool->object_size;
 
@@ -923,6 +937,7 @@
 void
 Parrot_gc_clear_live_bits(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_clear_live_bits)
     Small_Object_Pool * const pool = interp->arena_base->pmc_pool;
     clear_live_bits(pool);
 }
@@ -941,6 +956,7 @@
 int
 Parrot_gc_trace_children(PARROT_INTERP, size_t how_many)
 {
+    ASSERT_ARGS(Parrot_gc_trace_children)
     Arenas * const arena_base = interp->arena_base;
     const int      lazy_dod   = arena_base->lazy_dod;
     PMC           *current    = arena_base->dod_mark_start;
@@ -1030,6 +1046,7 @@
 void
 Parrot_gc_trace_pmc_data(PARROT_INTERP, ARGIN(PMC *p))
 {
+    ASSERT_ARGS(Parrot_gc_trace_pmc_data)
     /* malloced array of PMCs */
     PMC ** const data = PMC_data_typed(p, PMC **);
 
@@ -1058,6 +1075,7 @@
         ARGMOD(Small_Object_Pool  *pool),
         ARGMOD(Small_Object_Arena *arena))
 {
+    ASSERT_ARGS(Parrot_add_to_free_list)
     UINTVAL  i;
     void    *object;
     const UINTVAL num_objects = pool->objects_per_alloc;
@@ -1093,6 +1111,7 @@
     ARGMOD(Small_Object_Pool *pool),
     ARGMOD(Small_Object_Arena *new_arena), size_t size)
 {
+    ASSERT_ARGS(Parrot_append_arena_in_pool)
 
     /* Maintain the *_arena_memory invariant for stack walking code. Set it
      * regardless if we're the first pool to be added. */
@@ -1131,6 +1150,7 @@
 static void
 gc_ms_alloc_objects(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ms_alloc_objects)
     /* Setup memory for the new objects */
     Small_Object_Arena * const new_arena =
         mem_internal_allocate_typed(Small_Object_Arena);
@@ -1184,6 +1204,7 @@
 Small_Object_Pool *
 new_small_object_pool(size_t object_size, size_t objects_per_alloc)
 {
+    ASSERT_ARGS(new_small_object_pool)
     Small_Object_Pool * const pool =
         mem_internal_allocate_zeroed_typed(Small_Object_Pool);
 
@@ -1211,6 +1232,7 @@
 void
 gc_pmc_ext_pool_init(ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_pmc_ext_pool_init)
     pool->add_free_object = gc_ms_add_free_pmc_ext;
     pool->get_free_object = gc_ms_get_free_pmc_ext;
     pool->alloc_objects   = gc_ms_alloc_objects;
@@ -1233,6 +1255,7 @@
 static void
 gc_ms_pool_init(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ms_pool_init)
     pool->add_free_object = gc_ms_add_free_object;
     pool->get_free_object = gc_ms_get_free_object;
     pool->alloc_objects   = gc_ms_alloc_objects;
@@ -1256,6 +1279,7 @@
 void
 Parrot_gc_ms_init(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_ms_init)
     Arenas * const arena_base     = interp->arena_base;
 
     arena_base->do_gc_mark         = Parrot_gc_ms_run;
@@ -1281,6 +1305,7 @@
 Parrot_small_object_pool_merge(PARROT_INTERP,
         ARGMOD(Small_Object_Pool *dest), ARGMOD(Small_Object_Pool *source))
 {
+    ASSERT_ARGS(Parrot_small_object_pool_merge)
     Small_Object_Arena  *cur_arena;
     void               **free_list_end;
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About