[svn:parrot] r38656 - in trunk: docs/pdds src src/gc

Infinoid at svn.parrot.org Infinoid at svn.parrot.org
Sat May 9 21:58:21 UTC 2009


Author: Infinoid
Date: Sat May  9 21:58:21 2009
New Revision: 38656
URL: https://trac.parrot.org/parrot/changeset/38656

Log:
[cage] Some codetest fixes.

Modified:
   trunk/docs/pdds/pdd09_gc.pod
   trunk/src/gc/api.c
   trunk/src/gc/mark_sweep.c
   trunk/src/gc/pools.c
   trunk/src/pmc_freeze.c
   trunk/src/stacks.c

Modified: trunk/docs/pdds/pdd09_gc.pod
==============================================================================
--- trunk/docs/pdds/pdd09_gc.pod	Sat May  9 21:58:13 2009	(r38655)
+++ trunk/docs/pdds/pdd09_gc.pod	Sat May  9 21:58:21 2009	(r38656)
@@ -380,8 +380,8 @@
 For a concurrent collector, calls to this function may activate a concurrent
 collection thread or, if such a thread is already running, do nothing at all.
 
-The C<do_gc_mark> function is called from the C<Parrot_gc_mark_and_sweep> function,
-and should not usually be called directly.
+The C<do_gc_mark> function is called from the C<Parrot_gc_mark_and_sweep>
+function, and should not usually be called directly.
 
 C<flags> is one of:
 
@@ -570,9 +570,9 @@
 =item PObj_custom_mark_FLAG
 
 The C<mark> vtable slot will be called during the GC mark phase. The mark
-function must call C<Parrot_gc_mark_PObj_alive> for all non-NULL objects (Buffers and
-PMCs) that PMC refers to. This flag is typically tested and the custom mark
-VTABLE method called from C<src/gc/api.c:mark_special>.
+function must call C<Parrot_gc_mark_PObj_alive> for all non-NULL objects
+(Buffers and PMCs) that PMC refers to. This flag is typically tested and the
+custom mark VTABLE method called from C<src/gc/api.c:mark_special>.
 
 =item PObj_external_FLAG
 

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Sat May  9 21:58:13 2009	(r38655)
+++ trunk/src/gc/api.c	Sat May  9 21:58:21 2009	(r38656)
@@ -200,6 +200,7 @@
 void
 Parrot_gc_finalize(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_finalize)
     if (interp->arena_base->finalize_gc_system)
         interp->arena_base->finalize_gc_system(interp);
 }
@@ -297,7 +298,7 @@
     ASSERT_ARGS(Parrot_gc_add_pmc_ext)
     Small_Object_Pool * const pool = interp->arena_base->pmc_ext_pool;
     pmc->pmc_ext = (PMC_EXT *)pool->get_free_object(interp, pool);
-    if(!pmc->pmc_ext)
+    if (!pmc->pmc_ext)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
             "Parrot VM: PMC_EXT allocation failed!\n");
     PObj_is_PMC_EXT_SET(pmc);
@@ -366,7 +367,7 @@
     if (!PObj_is_PMC_EXT_TEST(pmc))
         Parrot_gc_add_pmc_ext(interp, pmc);
     PMC_sync(pmc) = mem_allocate_typed(Sync);
-    if(!PMC_sync(pmc))
+    if (!PMC_sync(pmc))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
             "Parrot VM: PMC Sync allocation failed!\n");
 
@@ -397,7 +398,7 @@
         (flags & PObj_constant_FLAG)
             ? interp->arena_base->constant_string_header_pool
             : interp->arena_base->string_header_pool);
-    if(!string)
+    if (!string)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
             "Parrot VM: STRING allocation failed!\n");
 
@@ -421,7 +422,7 @@
 void
 Parrot_gc_free_string_header(PARROT_INTERP, ARGMOD(STRING *s))
 {
-    ASSERT_ARGS(Parrot_gc_free_string_header);
+    ASSERT_ARGS(Parrot_gc_free_string_header)
     if (!PObj_constant_TEST(s)) {
         Small_Object_Pool * const pool = interp->arena_base->string_header_pool;
         pool->add_free_object(interp, pool, s);
@@ -469,7 +470,7 @@
 Parrot_gc_free_bufferlike_header(PARROT_INTERP, ARGMOD(PObj *obj),
     size_t size)
 {
-    ASSERT_ARGS(Parrot_gc_free_bufferlike_header);
+    ASSERT_ARGS(Parrot_gc_free_bufferlike_header)
     Small_Object_Pool * const pool = get_bufferlike_pool(interp, size);
     pool->add_free_object(interp, pool, obj);
 }
@@ -1014,6 +1015,7 @@
 int
 Parrot_gc_ptr_is_pmc(PARROT_INTERP, ARGIN(void *ptr))
 {
+    ASSERT_ARGS(Parrot_gc_ptr_is_pmc)
     return contained_in_pool(interp->arena_base->pmc_pool, ptr) ||
            contained_in_pool(interp->arena_base->constant_pmc_pool, ptr);
 }
@@ -1127,6 +1129,7 @@
 int
 Parrot_gc_active_sized_buffers(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_active_sized_buffers)
     int j, ret = 0;
     const Arenas * const arena_base = interp->arena_base;
     for (j = 0; j < (INTVAL)arena_base->num_sized; j++) {
@@ -1152,6 +1155,7 @@
 int
 Parrot_gc_total_sized_buffers(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_total_sized_buffers)
     int j, ret = 0;
     const Arenas * const arena_base = interp->arena_base;
     for (j = 0; j < (INTVAL)arena_base->num_sized; j++) {
@@ -1176,6 +1180,7 @@
 int
 Parrot_gc_active_pmcs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_active_pmcs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->pmc_pool->total_objects -
            arena_base->pmc_pool->num_free_objects;
@@ -1194,6 +1199,7 @@
 int
 Parrot_gc_total_pmcs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_total_pmcs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->pmc_pool->total_objects;
 }
@@ -1241,6 +1247,7 @@
 size_t
 Parrot_gc_count_mark_runs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_count_mark_runs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->gc_mark_runs;
 }
@@ -1248,6 +1255,7 @@
 size_t
 Parrot_gc_count_collect_runs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_count_collect_runs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->gc_collect_runs;
 }
@@ -1255,6 +1263,7 @@
 size_t
 Parrot_gc_count_lazy_mark_runs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_count_lazy_mark_runs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->gc_lazy_mark_runs;;
 }
@@ -1262,6 +1271,7 @@
 size_t
 Parrot_gc_total_memory_allocated(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_total_memory_allocated)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->memory_allocated;
 }
@@ -1269,6 +1279,7 @@
 size_t
 Parrot_gc_headers_alloc_since_last_collect(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_headers_alloc_since_last_collect)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->header_allocs_since_last_collect;
 }
@@ -1276,6 +1287,7 @@
 size_t
 Parrot_gc_mem_alloc_since_last_collect(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_mem_alloc_since_last_collect)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->mem_allocs_since_last_collect;
 }
@@ -1283,6 +1295,7 @@
 UINTVAL
 Parrot_gc_total_copied(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_total_copied)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->memory_collected;
 }
@@ -1290,6 +1303,7 @@
 UINTVAL
 Parrot_gc_impatient_pmcs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_impatient_pmcs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->num_early_gc_PMCs;
 }
@@ -1297,6 +1311,7 @@
 UINTVAL
 Parrot_gc_extended_pmcs(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_extended_pmcs)
     const Arenas * const arena_base = interp->arena_base;
     return arena_base->num_extended_PMCs;
 }
@@ -1340,6 +1355,7 @@
 void
 Parrot_block_GC_mark(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_block_GC_mark)
     interp->arena_base->gc_mark_block_level++;
     Parrot_shared_gc_block(interp);
 }
@@ -1348,6 +1364,7 @@
 void
 Parrot_unblock_GC_mark(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_unblock_GC_mark)
     if (interp->arena_base->gc_mark_block_level) {
         interp->arena_base->gc_mark_block_level--;
         Parrot_shared_gc_unblock(interp);
@@ -1358,6 +1375,7 @@
 void
 Parrot_block_GC_sweep(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_block_GC_sweep)
     interp->arena_base->gc_sweep_block_level++;
 }
 
@@ -1365,6 +1383,7 @@
 void
 Parrot_unblock_GC_sweep(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_unblock_GC_sweep)
     if (interp->arena_base->gc_sweep_block_level)
         interp->arena_base->gc_sweep_block_level--;
 }
@@ -1373,6 +1392,7 @@
 unsigned int
 Parrot_is_blocked_GC_mark(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_is_blocked_GC_mark)
     return interp->arena_base->gc_mark_block_level;
 }
 
@@ -1380,12 +1400,14 @@
 unsigned int
 Parrot_is_blocked_GC_sweep(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_is_blocked_GC_sweep)
     return interp->arena_base->gc_sweep_block_level;
 }
 
 void
 Parrot_gc_completely_unblock(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_gc_completely_unblock)
     interp->arena_base->gc_mark_block_level  = 0;
     interp->arena_base->gc_sweep_block_level = 0;
 }
@@ -1403,6 +1425,7 @@
 void
 Parrot_gc_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc))
 {
+    ASSERT_ARGS(Parrot_gc_pmc_needs_early_collection)
     PObj_needs_early_gc_SET(pmc);
     ++interp->arena_base->num_early_gc_PMCs;
 }

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Sat May  9 21:58:13 2009	(r38655)
+++ trunk/src/gc/mark_sweep.c	Sat May  9 21:58:21 2009	(r38656)
@@ -503,7 +503,7 @@
                     }
                 }
 
-                if(gc_object)
+                if (gc_object)
                     gc_object(interp, pool, b);
 
                 pool->add_free_object(interp, pool, b);

Modified: trunk/src/gc/pools.c
==============================================================================
--- trunk/src/gc/pools.c	Sat May  9 21:58:13 2009	(r38655)
+++ trunk/src/gc/pools.c	Sat May  9 21:58:21 2009	(r38656)
@@ -60,6 +60,10 @@
 
 /*
 
+=head2 Buffer Header Functions for small-object lookup table
+
+=over 4
+
 =item C<void Parrot_merge_memory_pools(Interp *dest_interp, Interp
 *source_interp)>
 
@@ -84,10 +88,6 @@
 
 /*
 
-=head2 Buffer Header Functions for small-object lookup table
-
-=over 4
-
 =item C<void * get_free_buffer(PARROT_INTERP, Small_Object_Pool *pool)>
 
 Gets a free object or buffer from the given C<pool> and returns it.  If the

Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c	Sat May  9 21:58:13 2009	(r38655)
+++ trunk/src/pmc_freeze.c	Sat May  9 21:58:21 2009	(r38656)
@@ -1365,6 +1365,7 @@
 static UINTVAL
 id_from_pmc(PARROT_INTERP, ARGIN(PMC* pmc))
 {
+    ASSERT_ARGS(id_from_pmc)
     return Parrot_gc_get_pmc_index(interp, pmc) << 2;
 }
 

Modified: trunk/src/stacks.c
==============================================================================
--- trunk/src/stacks.c	Sat May  9 21:58:13 2009	(r38655)
+++ trunk/src/stacks.c	Sat May  9 21:58:21 2009	(r38656)
@@ -75,7 +75,7 @@
 {
     ASSERT_ARGS(cst_new_stack_chunk)
     Stack_Chunk_t * const new_chunk =
-        (Stack_Chunk_t *)Parrot_gc_new_bufferlike_header(interp, sizeof(Stack_Chunk_t));
+        (Stack_Chunk_t *)Parrot_gc_new_bufferlike_header(interp, sizeof (Stack_Chunk_t));
 
     PObj_bufstart(new_chunk) = NULL;
     PObj_buflen(new_chunk)   = 0;
@@ -104,7 +104,7 @@
 {
     ASSERT_ARGS(new_stack)
     Stack_Chunk_t * const chunk =
-        (Stack_Chunk_t *)Parrot_gc_new_bufferlike_header(interp, sizeof(Stack_Chunk_t));
+        (Stack_Chunk_t *)Parrot_gc_new_bufferlike_header(interp, sizeof (Stack_Chunk_t));
 
     chunk->prev = chunk;        /* mark the top of the stack */
     chunk->name = name;


More information about the parrot-commits mailing list