Author: chromatic
Date: Sat Apr 14 13:50:06 2007
New Revision: 18206

Modified:
   trunk/include/parrot/resources.h
   trunk/include/parrot/smallobject.h
   trunk/src/gc/dod.c
   trunk/src/gc/gc_gms.c
   trunk/src/gc/gc_ims.c
   trunk/src/gc/memory.c
   trunk/src/gc/resources.c
   trunk/src/gc/smallobject.c
   trunk/src/headers.c
   trunk/src/inter_misc.c
   trunk/src/pmc.c
   trunk/src/pmc/retcontinuation.pmc
   trunk/src/pmc_freeze.c
   trunk/src/runops_cores.c
   trunk/src/stack_common.c

Log:
Fixed most casts in src/gc/*.c for C++ compatibility.  I left a couple of weird 
void <-> char pointer problems in there, because they probably mask deeper 
problems.

Added typedefs to several related structs and made the appropriate changes to 
the .c files.

Modified: trunk/include/parrot/resources.h
==============================================================================
--- trunk/include/parrot/resources.h    (original)
+++ trunk/include/parrot/resources.h    Sat Apr 14 13:50:06 2007
@@ -15,17 +15,17 @@
 
 #include "parrot/parrot.h"
 
-struct Memory_Block {
+typedef struct Memory_Block {
     size_t free;
     size_t size;
     struct Memory_Block *prev;
     struct Memory_Block *next;
     char *start;
     char *top;
-};
+} Memory_Block;
 
-struct Memory_Pool {
-    struct Memory_Block *top_block;
+typedef struct Memory_Pool {
+    Memory_Block *top_block;
     void (*compact)(Interp *, struct Memory_Pool *);
     size_t minimum_block_size;
     size_t total_allocated; /* total bytes allocated to this pool */
@@ -33,7 +33,7 @@
     size_t possibly_reclaimable;     /* bytes that can possibly be reclaimed
                                       * (above plus COW-freed bytes) */
     FLOATVAL reclaim_factor; /* minimum percentage we will reclaim */
-};
+} Memory_Pool;
 
 
 
@@ -54,9 +54,9 @@
 
 void Parrot_go_collect(Interp *);
 
-struct Arenas {
-    struct Memory_Pool *memory_pool;
-    struct Memory_Pool *constant_string_pool;
+typedef struct Arenas {
+    Memory_Pool *memory_pool;
+    Memory_Pool *constant_string_pool;
     struct Small_Object_Pool *string_header_pool;
     struct Small_Object_Pool *pmc_pool;
     struct Small_Object_Pool *pmc_ext_pool;
@@ -114,7 +114,7 @@
      * private data for the GC subsystem
      */
     void *  gc_private;         /* gc subsystem data */
-};
+} Arenas;
 
 /* &gen_from_enum(interpinfo.pasm) prefix(INTERPINFO_) */
 

Modified: trunk/include/parrot/smallobject.h
==============================================================================
--- trunk/include/parrot/smallobject.h  (original)
+++ trunk/include/parrot/smallobject.h  Sat Apr 14 13:50:06 2007
@@ -3,13 +3,13 @@
 
 #  include "parrot/parrot.h"
 
-struct Small_Object_Arena {
+typedef struct Small_Object_Arena {
     size_t used;
     size_t total_objects;
     struct Small_Object_Arena *prev;
     struct Small_Object_Arena *next;
     void *start_objects;
-};
+} Small_Object_Arena;
 
 
 struct Small_Object_Pool;
@@ -77,8 +77,8 @@
 #endif
 
 /* Tracked resource pool */
-struct Small_Object_Pool {
-    struct Small_Object_Arena *last_Arena;
+typedef struct Small_Object_Pool {
+    Small_Object_Arena *last_Arena;
     /* Size in bytes of an individual pool item. This size may include
      * a GC-system specific GC header.
      * See the macros below.
@@ -97,7 +97,7 @@
     alloc_objects_fn_type       more_objects;
     /* gets and removes a free object from the pool's free list */
     /* allocates more objects */
-    void *mem_pool;
+    struct Memory_Pool *mem_pool;
     size_t start_arena_memory;
     size_t end_arena_memory;
     const char *name;
@@ -113,7 +113,7 @@
     struct _gc_gms_gen *last_gen;
 
 #endif
-};
+} Small_Object_Pool;
 
 /*
  * macros used in arena scan code to convert from object pointers
@@ -143,9 +143,9 @@
 int Parrot_is_const_pmc(Parrot_Interp, PMC *);
 
 void Parrot_append_arena_in_pool(Interp *, struct Small_Object_Pool *pool,
-    struct Small_Object_Arena *new_arena, size_t size);
+    Small_Object_Arena *new_arena, size_t size);
 void Parrot_add_to_free_list(Interp *, struct Small_Object_Pool *pool,
-        struct Small_Object_Arena *arena, UINTVAL start, UINTVAL end);
+        Small_Object_Arena *arena, UINTVAL start, UINTVAL end);
 
 void Parrot_small_object_pool_merge(Interp *dest_interp,
         struct Small_Object_Pool *dest, struct Small_Object_Pool *source);

Modified: trunk/src/gc/dod.c
==============================================================================
--- trunk/src/gc/dod.c  (original)
+++ trunk/src/gc/dod.c  Sat Apr 14 13:50:06 2007
@@ -59,7 +59,7 @@
 mark_special(Parrot_Interp interp, PMC* obj)
 {
     int hi_prio;
-    struct Arenas *arena_base;
+    Arenas *arena_base;
 
     /*
      * If the object is shared, we have to use the arena and dod
@@ -213,7 +213,7 @@
 Parrot_dod_trace_root(Interp *interp, int trace_stack)
 {
 
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     parrot_context_t *ctx;
 
     /*
@@ -335,7 +335,7 @@
 Parrot_dod_trace_children(Interp *interp, size_t how_many)
 {
     PMC *next;
-    struct Arenas * const arena_base = interp->arena_base;
+    Arenas * const arena_base = interp->arena_base;
     INTVAL i = 0;
     const UINTVAL mask = PObj_data_is_PMC_array_FLAG | PObj_custom_mark_FLAG;
     PMC *current = arena_base->dod_mark_start;
@@ -383,7 +383,7 @@
         if (bits) {
             if (bits == PObj_data_is_PMC_array_FLAG) {
                 /* malloced array of PMCs */
-                PMC **data = PMC_data(current);
+                PMC **data = PMC_data_typed(current, PMC **);
 
                 if (data) {
                     for (i = 0; i < PMC_int_val(current); i++) {
@@ -421,8 +421,7 @@
 /*
 
 =item C<void
-clear_cow(Interp *interp, struct Small_Object_Pool *pool,
-        int cleanup)>
+clear_cow(Interp *interp, Small_Object_Pool *pool, int cleanup)>
 
 Clear the COW ref count.
 
@@ -431,11 +430,10 @@
 */
 
 void
-clear_cow(Interp *interp, struct Small_Object_Pool *pool,
-        int cleanup)
+clear_cow(Interp *interp, Small_Object_Pool *pool, int cleanup)
 {
     const UINTVAL object_size = pool->object_size;
-    struct Small_Object_Arena *cur_arena;
+    Small_Object_Arena *cur_arena;
 
     /* clear refcount for COWable objects. */
     for (cur_arena = pool->last_Arena;
@@ -469,8 +467,7 @@
 /*
 
 =item C<void
-used_cow(Interp *interp, struct Small_Object_Pool *pool,
-        int cleanup)>
+used_cow(Interp *interp, Small_Object_Pool *pool, int cleanup)>
 
 Find other users of COW's C<bufstart>.
 
@@ -479,10 +476,10 @@
 */
 
 void
-used_cow(Interp *interp, struct Small_Object_Pool *pool, int cleanup)
+used_cow(Interp *interp, Small_Object_Pool *pool, int cleanup)
 {
     UINTVAL object_size = pool->object_size;
-    struct Small_Object_Arena *cur_arena;
+    Small_Object_Arena *cur_arena;
 
     for (cur_arena = pool->last_Arena;
             NULL != cur_arena; cur_arena = cur_arena->prev) {
@@ -510,8 +507,7 @@
 /*
 
 =item C<void
-Parrot_dod_sweep(Interp *interp,
-        struct Small_Object_Pool *pool)>
+Parrot_dod_sweep(Interp *interp, Small_Object_Pool *pool)>
 
 Put any buffers/PMCs that are now unused onto the pool's free list. If
 C<GC_IS_MALLOC>, bufstart gets freed too, if possible. Avoid buffers that
@@ -522,11 +518,10 @@
 */
 
 void
-Parrot_dod_sweep(Interp *interp,
-        struct Small_Object_Pool *pool)
+Parrot_dod_sweep(Interp *interp, Small_Object_Pool *pool)
 {
-    struct Arenas *arena_base = interp->arena_base;
-    struct Small_Object_Arena *cur_arena;
+    Arenas *arena_base = interp->arena_base;
+    Small_Object_Arena *cur_arena;
     UINTVAL i, total_used = 0;
     UINTVAL object_size = pool->object_size;
     size_t nm;
@@ -548,7 +543,7 @@
     /* Run through all the buffer header pools and mark */
     for (cur_arena = pool->last_Arena;
             NULL != cur_arena; cur_arena = cur_arena->prev) {
-        Buffer *b = cur_arena->start_objects;
+        Buffer *b = (Buffer *)cur_arena->start_objects;
 
         for (i = nm = 0; i < cur_arena->used; i++) {
             if (PObj_on_free_list_TEST(b))
@@ -600,7 +595,7 @@
                         /* if the PMC has a PMC_EXT structure,
                          * return it to the pool/arena
                          */
-                        struct Small_Object_Pool *ext_pool =
+                        Small_Object_Pool *ext_pool =
                             arena_base->pmc_ext_pool;
                         if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) {
                             MUTEX_DESTROY(PMC_sync(p)->pmc_lock);
@@ -614,9 +609,9 @@
                     /*
                      * invalidate the PMC
                      */
-                    p->vtable = (void*)0xdeadbeef;
-                    PMC_pmc_val(p) = (void*)0xdeadbeef;
-                    p->pmc_ext = (void*)0xdeadbeef;
+                    p->vtable      = (VTABLE *)0xdeadbeef;
+                    PMC_pmc_val(p) = (PMC *)0xdeadbeef;
+                    p->pmc_ext     = (PMC_EXT *)0xdeadbeef;
 #endif
                 }
                 /* else object is a buffer(like) */
@@ -649,11 +644,11 @@
                      */
                     if (pool->mem_pool) {
                         if (!PObj_COW_TEST(b)) {
-                            ((struct Memory_Pool *)
+                            ((Memory_Pool *)
                              pool->mem_pool)->guaranteed_reclaimable +=
                                 PObj_buflen(b);
                         }
-                        ((struct Memory_Pool *)
+                        ((Memory_Pool *)
                          pool->mem_pool)->possibly_reclaimable +=
                             PObj_buflen(b);
                     }
@@ -786,14 +781,13 @@
 */
 
 static void
-clear_live_bits(Parrot_Interp interp,
-        struct Small_Object_Pool * const pool) {
-    struct Small_Object_Arena *arena;
+clear_live_bits(Parrot_Interp interp, Small_Object_Pool * const pool) {
+    Small_Object_Arena *arena;
     UINTVAL i;
     const UINTVAL object_size = pool->object_size;
 
     for (arena = pool->last_Arena; arena; arena = arena->prev) {
-        Buffer *b = arena->start_objects;
+        Buffer *b = (Buffer *)arena->start_objects;
         for (i = 0; i < arena->used; i++) {
             PObj_live_CLEAR(b);
             b = (Buffer *)((char *)b + object_size);
@@ -805,7 +799,7 @@
 void
 Parrot_dod_clear_live_bits(Parrot_Interp interp)
 {
-    struct Small_Object_Pool * const pool = interp->arena_base->pmc_pool;
+    Small_Object_Pool * const pool = interp->arena_base->pmc_pool;
     clear_live_bits(interp, pool);
 }
 
@@ -886,7 +880,7 @@
 void
 Parrot_dod_ms_run_init(Interp *interp)
 {
-    struct Arenas * const arena_base = interp->arena_base;
+    Arenas * const arena_base = interp->arena_base;
 
     arena_base->dod_trace_ptr = NULL;
     arena_base->dod_mark_start = NULL;
@@ -895,8 +889,7 @@
 }
 
 static int
-sweep_cb(Interp *interp, struct Small_Object_Pool *pool, int flag,
-        void *arg)
+sweep_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     int * const total_free = (int *) arg;
 #ifdef GC_IS_MALLOC
@@ -917,7 +910,7 @@
 void
 Parrot_dod_ms_run(Interp *interp, int flags)
 {
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     /* XXX these should go into the interpreter */
     int total_free = 0;
 

Modified: trunk/src/gc/gc_gms.c
==============================================================================
--- trunk/src/gc/gc_gms.c       (original)
+++ trunk/src/gc/gc_gms.c       Sat Apr 14 13:50:06 2007
@@ -175,14 +175,14 @@
  * static forward defs
  */
 static void gc_gms_add_free_object(Interp *,
-        struct Small_Object_Pool *pool, void *to_add);
-static void * gc_gms_get_free_object(Interp *, struct Small_Object_Pool *);
-static void gc_gms_alloc_objects(Interp *, struct Small_Object_Pool *);
-static void gc_gms_more_objects(Interp *, struct Small_Object_Pool *);
-static void gc_gms_init_gen(Interp *, struct Small_Object_Pool *);
+        Small_Object_Pool *pool, void *to_add);
+static void * gc_gms_get_free_object(Interp *, Small_Object_Pool *);
+static void gc_gms_alloc_objects(Interp *, Small_Object_Pool *);
+static void gc_gms_more_objects(Interp *, Small_Object_Pool *);
+static void gc_gms_init_gen(Interp *, Small_Object_Pool *);
 static void parrot_gc_gms_run(Interp *, int flags);
 #  if GC_GMS_DEBUG
-static void gms_debug_verify(Interp *, struct Small_Object_Pool *pool,
+static void gms_debug_verify(Interp *, Small_Object_Pool *pool,
         const char *action);
 #  endif
 /*
@@ -197,7 +197,7 @@
 
 Free used resources.
 
-=item C<static void gc_gms_pool_init(Interp *, struct Small_Object_Pool *pool)>
+=item C<static void gc_gms_pool_init(Interp *, Small_Object_Pool *pool)>
 
 Initialize pool variables. This function must set the pool function pointers
 for C<add_free_object>, C<get_free_object>, C<alloc_objects>, and
@@ -216,7 +216,7 @@
 static void
 parrot_gc_gms_deinit(Interp* interp)
 {
-    struct Arenas *arena_base;
+    Arenas *arena_base;
 
     arena_base = interp->arena_base;
     /*
@@ -227,7 +227,7 @@
 }
 
 static void
-gc_gms_pool_init(Interp *interp, struct Small_Object_Pool *pool)
+gc_gms_pool_init(Interp *interp, Small_Object_Pool *pool)
 {
     pool->add_free_object = gc_gms_add_free_object;
     pool->get_free_object = gc_gms_get_free_object;
@@ -244,8 +244,8 @@
 void
 Parrot_gc_gms_init(Interp* interp)
 {
-    struct Arenas *arena_base;
-    struct Small_Object_Pool *pool;
+    Arenas *arena_base;
+    Small_Object_Pool *pool;
 
     arena_base = interp->arena_base;
     arena_base->gc_private = mem_sys_allocate_zeroed(sizeof (Gc_gms_private));
@@ -267,24 +267,20 @@
 
 =over 4
 
-=item C<static void gc_gms_add_free_object(Interp *,
-                                           struct Small_Object_Pool *pool,
+=item C<static void gc_gms_add_free_object(Interp *, Small_Object_Pool *pool,
                                            void *to_add)>
 
 Unused. White (dead) objects are added in a bunch to the free_list.
 
-=item C<static void * gc_gms_get_free_object(Interp *,
-                                             struct Small_Object_Pool *pool)>
+=item C<static void * gc_gms_get_free_object(Interp *, Small_Object_Pool 
*pool)>
 
 Get a new object off the free_list in the given pool.
 
-=item C<static void gc_gms_alloc_objects(Interp *,
-                                         struct Small_Object_Pool *pool)>
+=item C<static void gc_gms_alloc_objects(Interp *, Small_Object_Pool *pool)>
 
 Allocate new objects for the given pool.
 
-=item C<static void gc_gms_more_objects(Interp *,
-                                        struct Small_Object_Pool *pool)>
+=item C<static void gc_gms_more_objects(Interp *, Small_Object_Pool *pool)>
 
 Run a GC cycle or allocate new objects for the given pool.
 
@@ -293,8 +289,7 @@
 */
 
 static void
-gc_gms_add_free_object(Interp *interp,
-        struct Small_Object_Pool *pool, void *to_add)
+gc_gms_add_free_object(Interp *interp, Small_Object_Pool *pool, void *to_add)
 {
     internal_exception(1, "gms abuse");
 }
@@ -338,8 +333,8 @@
 
 static void
 gc_gms_chain_objects(Interp *interp,
-        struct Small_Object_Pool *pool,
-        struct Small_Object_Arena *new_arena,
+        Small_Object_Pool *pool,
+        Small_Object_Arena *new_arena,
         size_t real_size)
 {
     Gc_gms_hdr *p, *next, *prev, *marker;
@@ -386,15 +381,14 @@
 }
 
 static void
-gc_gms_alloc_objects(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_gms_alloc_objects(Interp *interp, Small_Object_Pool *pool)
 {
-    struct Small_Object_Arena *new_arena;
+    Small_Object_Arena *new_arena;
     size_t size, real_size;
 
 
     real_size = pool->object_size;
-    new_arena = mem_internal_allocate(sizeof (struct Small_Object_Arena));
+    new_arena = mem_internal_allocate(sizeof (Small_Object_Arena));
     size = real_size * pool->objects_per_alloc;
     new_arena->start_objects = mem_internal_allocate(size);
     /* insert arena in list */
@@ -412,10 +406,9 @@
 }
 
 static void
-gc_gms_more_objects(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_gms_more_objects(Interp *interp, Small_Object_Pool *pool)
 {
-    struct Small_Object_Arena *arena;
+    Small_Object_Arena *arena;
     if (pool->skip)
         pool->skip = 0;
     else if (pool->last_Arena) {
@@ -435,8 +428,7 @@
  */
 
 static void *
-gc_gms_get_free_object(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_gms_get_free_object(Interp *interp, Small_Object_Pool *pool)
 {
     PObj *ptr;
     Gc_gms_hdr *hdr;
@@ -461,13 +453,12 @@
 
 =over 4
 
-=item C<static Gc_gms_gen * gc_gms_create_gen(Interp *,
-                                              struct Small_Object_Pool *pool,
+=item C<static Gc_gms_gen * gc_gms_create_gen(Interp *, Small_Object_Pool 
*pool,
                                               size_t gen_no)>
 
 Create a generation structure for the given generation number.
 
-=item C<static void gc_gms_init_gen(Interp *, struct Small_Object_Pool *pool)>
+=item C<static void gc_gms_init_gen(Interp *, Small_Object_Pool *pool)>
 
 Initalize the generation system by creating the first two generations.
 
@@ -495,8 +486,7 @@
  */
 
 static Gc_gms_gen *
-gc_gms_create_gen(Interp *interp,
-        struct Small_Object_Pool *pool, size_t gen_no)
+gc_gms_create_gen(Interp *interp, Small_Object_Pool *pool, size_t gen_no)
 {
     Gc_gms_gen *gen;
 
@@ -512,8 +502,7 @@
 }
 
 static void
-gc_gms_init_gen(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_gms_init_gen(Interp *interp, Small_Object_Pool *pool)
 {
     Gc_gms_private *gmsp;
     /*
@@ -548,7 +537,7 @@
 gc_gms_find_gen(Interp *interp, Gc_gms_hdr *h, UINTVAL gen_no)
 {
     Gc_gms_gen *gen;
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
     UINTVAL i;
 
     pool = h->gen->pool;
@@ -576,7 +565,7 @@
 {
     Gc_gms_gen *gen;
     Gc_gms_hdr *prev, *next;
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
 
     pool = h->gen->pool;
     /* unsnap from current generation */
@@ -714,7 +703,7 @@
 } Gc_gms_plan;
 
 static void
-gc_gms_merge_gen(Interp *interp, struct Small_Object_Pool *pool,
+gc_gms_merge_gen(Interp *interp, Small_Object_Pool *pool,
         int flag, Gc_gms_plan *plan)
 {
     Gc_gms_gen *gen, *prev;
@@ -739,7 +728,7 @@
 }
 
 static void
-gc_gms_use_gen(Interp *interp, struct Small_Object_Pool *pool,
+gc_gms_use_gen(Interp *interp, Small_Object_Pool *pool,
         int flag, Gc_gms_plan *plan)
 {
     Gc_gms_gen *gen, *prev;
@@ -765,8 +754,7 @@
 }
 
 static int
-set_gen_cb(Interp *interp, struct Small_Object_Pool *pool, int flag,
-        void *arg)
+set_gen_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     Gc_gms_plan *plan = (Gc_gms_plan *)arg;
 
@@ -873,7 +861,7 @@
 static void
 gc_gms_setto_gray(Interp *interp, Gc_gms_hdr *h, int priority)
 {
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
     Gc_gms_hdr *next, *prev;
 
     pool = h->gen->pool;
@@ -940,7 +928,7 @@
 static void
 gc_gms_setto_black(Interp *interp, Gc_gms_hdr *h, int priority)
 {
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
     Gc_gms_hdr *next, *prev;
 
     pool = h->gen->pool;
@@ -1032,8 +1020,7 @@
 }
 
 static int
-init_mark_cb(Interp *interp, struct Small_Object_Pool *pool, int flag,
-        void *arg)
+init_mark_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     pool->gray = pool->black = pool->black_fin = pool->white;
 #  if GC_GMS_DEBUG
@@ -1045,7 +1032,7 @@
 static void
 gc_gms_init_mark(Interp *interp)
 {
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
 
     arena_base->dod_trace_ptr = NULL;
     arena_base->dod_mark_start = NULL;
@@ -1056,8 +1043,7 @@
 }
 
 static int
-trace_igp_cb(Interp *interp, struct Small_Object_Pool *pool, int flag,
-        void *arg)
+trace_igp_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     Gc_gms_gen *gen;
     Gc_gms_hdr_list *igp;
@@ -1110,10 +1096,9 @@
 */
 
 static int
-trace_children_cb(Interp *interp, struct Small_Object_Pool *pool,
-        int flag, void *arg)
+trace_children_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     int lazy_dod = arena_base->lazy_dod;
     UINTVAL mask = PObj_data_is_PMC_array_FLAG | PObj_custom_mark_FLAG;
     Gc_gms_hdr *h;
@@ -1176,11 +1161,10 @@
  * TODO put these in front of the pool at pool->white_fin
  */
 static int
-sweep_cb_pmc(Interp *interp, struct Small_Object_Pool *pool,
-        int flag, void *arg)
+sweep_cb_pmc(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     Gc_gms_hdr *h;
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
 
     /* TODO object stats */
 
@@ -1194,7 +1178,7 @@
             /* if the PMC has a PMC_EXT structure,
              * return it to the pool
              */
-            struct Small_Object_Pool *ext_pool = arena_base->pmc_ext_pool;
+            Small_Object_Pool *ext_pool = arena_base->pmc_ext_pool;
             ext_pool->add_free_object(interp, ext_pool, obj->pmc_ext);
         }
 
@@ -1204,8 +1188,7 @@
 }
 
 static int
-sweep_cb_buf(Interp *interp, struct Small_Object_Pool *pool,
-        int flag, void *arg)
+sweep_cb_buf(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     Gc_gms_hdr *h;
 
@@ -1245,11 +1228,11 @@
              */
             if (pool->mem_pool) {
                 if (!PObj_COW_TEST(obj)) {
-                    ((struct Memory_Pool *)
+                    ((Memory_Pool *)
                      pool->mem_pool)->guaranteed_reclaimable +=
                         PObj_buflen(obj);
                 }
-                ((struct Memory_Pool *)
+                ((Memory_Pool *)
                  pool->mem_pool)->possibly_reclaimable +=
                     PObj_buflen(obj);
             }
@@ -1269,8 +1252,7 @@
 }
 
 static int
-end_cycle_cb(Interp *interp, struct Small_Object_Pool *pool,
-        int flag, void *arg)
+end_cycle_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     Gc_gms_hdr *h;
     /*
@@ -1314,7 +1296,7 @@
 parrot_gc_gms_run(Interp *interp, int flags)
 {
     int lazy;
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     Gc_gms_private *g_gms;
 
     if (arena_base->DOD_block_level) {
@@ -1323,7 +1305,7 @@
     ++arena_base->DOD_block_level;
     g_gms = arena_base->gc_private;
     if (flags & DOD_finish_FLAG) {
-        struct Small_Object_Pool *pool;
+        Small_Object_Pool *pool;
 
         pool = arena_base->pmc_pool;
         pool->white = pool->marker.next;
@@ -1355,8 +1337,7 @@
 
 #  if GC_GMS_DEBUG
 static void
-gms_debug_verify(Interp *interp, struct Small_Object_Pool *pool,
-        const char *action)
+gms_debug_verify(Interp *interp, Small_Object_Pool *pool, const char *action)
 {
     Gc_gms_hdr *h, *next;
     int bf, gf, wf, ff;

Modified: trunk/src/gc/gc_ims.c
==============================================================================
--- trunk/src/gc/gc_ims.c       (original)
+++ trunk/src/gc/gc_ims.c       Sat Apr 14 13:50:06 2007
@@ -406,18 +406,18 @@
 /*
 
 =item C<static void gc_ims_add_free_object(Interp *interp,
-        struct Small_Object_Pool *pool, void *to_add)>
+        Small_Object_Pool *pool, void *to_add)>
 
 Add object C<to_add> to the free_list in the given pool.
 C<pool->num_free_objects> has to be updated by the caller.
 
 =item C<static void *
-gc_ims_get_free_object(Interp *, struct Small_Object_Pool *pool)>
+gc_ims_get_free_object(Interp *, Small_Object_Pool *pool)>
 
 Get a new object off the free_list in the given pool.
 
 =item C<static void
-gc_ims_alloc_objects(Interp *, struct Small_Object_Pool *pool)>
+gc_ims_alloc_objects(Interp *, Small_Object_Pool *pool)>
 
 Allocate new objects for the given pool.
 
@@ -426,15 +426,14 @@
 */
 
 static void
-gc_ims_add_free_object(Interp *interp,
-        struct Small_Object_Pool *pool, void *to_add)
+gc_ims_add_free_object(Interp *interp, Small_Object_Pool *pool, void *to_add)
 {
     *(void **)to_add = pool->free_list;
-    pool->free_list = to_add;
+    pool->free_list  = to_add;
 #if ! DISABLE_GC_DEBUG
     if (GC_DEBUG(interp)) {
         if (pool == interp->arena_base->pmc_pool) {
-            PMC *p = to_add;
+            PMC *p    = (PMC *)to_add;
             p->vtable = interp->vtables[enum_class_Null];
         }
     }
@@ -443,15 +442,14 @@
 
 
 static void *
-gc_ims_get_free_object(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_ims_get_free_object(Interp *interp, Small_Object_Pool *pool)
 {
     PObj *ptr;
-    struct Arenas *arena_base;
+    Arenas *arena_base;
     Gc_ims_private *g_ims;
 
     arena_base = interp->arena_base;
-    g_ims = arena_base->gc_private;
+    g_ims      = (Gc_ims_private *)arena_base->gc_private;
     if (++g_ims->allocations >= g_ims->alloc_trigger) {
         g_ims->allocations = 0;
         parrot_gc_ims_run_increment(interp);
@@ -459,7 +457,7 @@
     /* if we don't have any objects */
     if (!pool->free_list)
         (*pool->alloc_objects) (interp, pool);
-    ptr = pool->free_list;
+    ptr             = (PObj *)pool->free_list;
     pool->free_list = *(void **)ptr;
     /*
      * buffers are born black, PMCs not yet?
@@ -472,17 +470,17 @@
 }
 
 static void
-gc_ims_alloc_objects(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_ims_alloc_objects(Interp *interp, Small_Object_Pool *pool)
 {
-    struct Small_Object_Arena *new_arena;
+    Small_Object_Arena *new_arena;
     size_t size;
     UINTVAL start, end;
 
-    pool->objects_per_alloc = ALLOCATION_BLOCK_SIZE / pool->object_size;
+    pool->objects_per_alloc  = ALLOCATION_BLOCK_SIZE / pool->object_size;
+
     /* Setup memory for the new objects */
-    new_arena = mem_sys_allocate(sizeof (struct Small_Object_Arena));
-    size = ALLOCATION_BLOCK_SIZE;
+    new_arena                = mem_allocate_typed(Small_Object_Arena);
+    size                     = ALLOCATION_BLOCK_SIZE;
     new_arena->start_objects = mem_sys_allocate(size);
 
     Parrot_append_arena_in_pool(interp, pool, new_arena, size);
@@ -493,7 +491,7 @@
 }
 
 static void
-gc_ims_pool_init(Interp *interp, struct Small_Object_Pool *pool)
+gc_ims_pool_init(Interp *interp, Small_Object_Pool *pool)
 {
     pool->add_free_object = gc_ims_add_free_object;
     pool->get_free_object = gc_ims_get_free_object;
@@ -504,7 +502,7 @@
 static void
 parrot_gc_ims_deinit(Interp* interp)
 {
-    struct Arenas *arena_base;
+    Arenas *arena_base;
 
     arena_base = interp->arena_base;
     mem_sys_free(arena_base->gc_private);
@@ -527,7 +525,7 @@
 void
 Parrot_gc_ims_init(Interp* interp)
 {
-    struct Arenas *arena_base;
+    Arenas *arena_base;
 
     arena_base = interp->arena_base;
     arena_base->gc_private = mem_sys_allocate_zeroed(sizeof (Gc_ims_private));
@@ -558,7 +556,7 @@
 parrot_gc_ims_reinit(Interp* interp)
 {
     Gc_ims_private *g_ims;
-    struct Arenas *arena_base;
+    Arenas *arena_base;
 
     arena_base = interp->arena_base;
     arena_base->lazy_dod = 0;
@@ -569,7 +567,7 @@
      */
     Parrot_dod_trace_root(interp, 0);
 
-    g_ims = arena_base->gc_private;
+    g_ims        = (Gc_ims_private *)arena_base->gc_private;
     g_ims->state = GC_IMS_MARKING;
 
 }
@@ -592,12 +590,12 @@
 {
     Gc_ims_private *g_ims;
     size_t todo;
-    struct Arenas *arena_base;
+    Arenas *arena_base;
     double work_factor;
     PMC *next;
 
-    arena_base = interp->arena_base;
-    g_ims = arena_base->gc_private;
+    arena_base = (Arenas *)interp->arena_base;
+    g_ims      = (Gc_ims_private *)arena_base->gc_private;
     /*
      * use statistics from the previous run
      */
@@ -631,8 +629,7 @@
 */
 
 static int
-sweep_cb(Interp *interp, struct Small_Object_Pool *pool, int flag,
-        void *arg)
+sweep_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     int *n_obj = (int *) arg;
 
@@ -646,12 +643,12 @@
 static void
 parrot_gc_ims_sweep(Interp* interp)
 {
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     Gc_ims_private *g_ims;
     size_t n_objects;
 
     IMS_DEBUG((stderr, "\nSWEEP\n"));
-    g_ims = arena_base->gc_private;
+    g_ims = (Gc_ims_private *)arena_base->gc_private;
     /*
      * as we are now gonna kill objects, make sure that we
      * have traced the current stack
@@ -696,13 +693,12 @@
 #else
 
 static int
-collect_cb(Interp *interp, struct Small_Object_Pool *pool, int flag,
-        void *arg)
+collect_cb(Interp *interp, Small_Object_Pool *pool, int flag, void *arg)
 {
     int check_only = (int)(INTVAL)arg;
-    struct Memory_Pool *mem_pool;
+    Memory_Pool *mem_pool;
     /*
-     * check if there is an associate memory pool
+     * check if there is an associated memory pool
      */
     mem_pool = pool->mem_pool;
     if (!mem_pool)
@@ -735,14 +731,14 @@
 static int
 parrot_gc_ims_collect(Interp* interp, INTVAL check_only)
 {
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     Gc_ims_private *g_ims;
     int ret;
 
     if (!check_only && interp->profile)
         Parrot_dod_profile_start(interp);
-    g_ims = arena_base->gc_private;
-    ret = Parrot_forall_header_pools(interp, POOL_BUFFER,
+    g_ims = (Gc_ims_private *)arena_base->gc_private;
+    ret   = Parrot_forall_header_pools(interp, POOL_BUFFER,
             (void*)check_only, collect_cb);
     if (ret)
         return ret;
@@ -769,8 +765,8 @@
 static void
 parrot_gc_ims_run_increment(Interp* interp)
 {
-    struct Arenas *arena_base = interp->arena_base;
-    Gc_ims_private *g_ims = arena_base->gc_private;
+    Arenas *arena_base    = interp->arena_base;
+    Gc_ims_private *g_ims = (Gc_ims_private *)arena_base->gc_private;
 
     if (arena_base->DOD_block_level || g_ims->state == GC_IMS_DEAD) {
         return;
@@ -847,13 +843,12 @@
 parrot_gc_ims_run(Interp *interp, int flags)
 {
     int lazy;
-    struct Arenas *arena_base = interp->arena_base;
-    Gc_ims_private *g_ims = arena_base->gc_private;
+    Arenas *arena_base    = interp->arena_base;
+    Gc_ims_private *g_ims = (Gc_ims_private *)arena_base->gc_private;
 
     if (arena_base->DOD_block_level || g_ims->state == GC_IMS_DEAD) {
         return;
     }
-    g_ims = arena_base->gc_private;
 
     if (flags & DOD_finish_FLAG) {
         /*

Modified: trunk/src/gc/memory.c
==============================================================================
--- trunk/src/gc/memory.c       (original)
+++ trunk/src/gc/memory.c       Sat Apr 14 13:50:06 2007
@@ -185,7 +185,7 @@
 void
 mem_setup_allocator(Interp *interp)
 {
-    interp->arena_base = mem_sys_allocate_zeroed(sizeof (struct Arenas));
+    interp->arena_base = mem_allocate_zeroed_typed(Arenas);
     SET_NULL(interp->arena_base->sized_header_pools);
 
 #if PARROT_GC_MS

Modified: trunk/src/gc/resources.c
==============================================================================
--- trunk/src/gc/resources.c    (original)
+++ trunk/src/gc/resources.c    Sat Apr 14 13:50:06 2007
@@ -26,14 +26,14 @@
 #define RESOURCE_DEBUG 0
 #define RESOURCE_DEBUG_SIZE 1000000
 
-typedef void (*compact_f) (Interp *, struct Memory_Pool *);
+typedef void (*compact_f) (Interp *, Memory_Pool *);
 static void* aligned_mem(Buffer *buffer, char *mem);
 
 /*
 
 =item C<static void *
 alloc_new_block(Interp *interp,
-        size_t size, struct Memory_Pool *pool, const char *why)>
+        size_t size, Memory_Pool *pool, const char *why)>
 
 Allocate a new memory block. We allocate the larger of however much was
 asked for or the default size, whichever's larger. The given text is
@@ -44,10 +44,9 @@
 */
 
 static void *
-alloc_new_block(Interp *interp,
-        size_t size, struct Memory_Pool *pool, const char *why)
+alloc_new_block(Interp *interp, size_t size, Memory_Pool *pool, const char 
*why)
 {
-    struct Memory_Block *new_block;
+    Memory_Block *new_block;
 
     const size_t alloc_size = (size > pool->minimum_block_size)
             ? size : pool->minimum_block_size;
@@ -59,8 +58,8 @@
 #endif
 
     /* Allocate a new block. Header info's on the front */
-    new_block = mem_internal_allocate_zeroed(sizeof (struct Memory_Block) +
-            alloc_size);
+    new_block = (Memory_Block *)mem_internal_allocate_zeroed(
+        sizeof (Memory_Block) + alloc_size);
     if (!new_block) {
         fprintf(stderr, "out of mem allocsize = %d\n", (int)alloc_size);
         exit(1);
@@ -70,7 +69,7 @@
     new_block->free = alloc_size;
     new_block->size = alloc_size;
     SET_NULL(new_block->next);
-    new_block->start = (char *)new_block + sizeof (struct Memory_Block);
+    new_block->start = (char *)new_block + sizeof (Memory_Block);
     new_block->top = new_block->start;
 
     /* Note that we've allocated it */
@@ -91,7 +90,7 @@
 /*
 
 =item C<static void *
-mem_allocate(Interp *, size_t size, struct Memory_Pool *pool)>
+mem_allocate(Interp *, size_t size, Memory_Pool *pool)>
 
 Allocates memory for headers.
 
@@ -127,10 +126,10 @@
 */
 
 
-static char *
-mem_allocate(Interp *interp, size_t size, struct Memory_Pool *pool)
+static void *
+mem_allocate(Interp *interp, size_t size, Memory_Pool *pool)
 {
-    char *return_val;
+    void *return_val;
 
     /* we always should have one block at least */
     assert(pool->top_block);
@@ -218,7 +217,7 @@
 =over
 
 =item C<static void
-compact_pool(Interp *interp, struct Memory_Pool *pool)>
+compact_pool(Interp *interp, Memory_Pool *pool)>
 
 Compact the buffer pool.
 
@@ -227,14 +226,14 @@
 */
 
 static void
-compact_pool(Interp *interp, struct Memory_Pool *pool)
+compact_pool(Interp *interp, Memory_Pool *pool)
 {
     UINTVAL total_size;
-    struct Memory_Block *new_block;     /* A pointer to our working block */
+    Memory_Block *new_block;     /* A pointer to our working block */
     char *cur_spot;             /* Where we're currently copying to */
-    struct Arenas * const arena_base = interp->arena_base;
-    struct Small_Object_Arena *cur_buffer_arena;
-    struct Small_Object_Pool *header_pool;
+    Arenas * const arena_base = interp->arena_base;
+    Small_Object_Arena *cur_buffer_arena;
+    Small_Object_Pool *header_pool;
     INTVAL j;
     UINTVAL object_size;
     INTVAL *ref_count = NULL;
@@ -255,7 +254,7 @@
     /* total-reclaimable == currently used. Add a minimum block to the current
      * amount, so we can avoid having to allocate it in the future. */
     {
-        struct Memory_Block *cur_block;
+        Memory_Block *cur_block;
 
         total_size = 0;
         cur_block = pool->top_block;
@@ -294,7 +293,7 @@
 #endif
 
     /* Snag a block big enough for everything */
-    new_block = alloc_new_block(interp, total_size, pool,
+    new_block = (Memory_Block *)alloc_new_block(interp, total_size, pool,
             "inside compact");
 
     /* Start at the beginning */
@@ -314,7 +313,8 @@
             Buffer *b;
             UINTVAL i;
 
-            b = ARENA_to_PObj(cur_buffer_arena->start_objects);
+            b = (Buffer *)ARENA_to_PObj(cur_buffer_arena->start_objects);
+
             for (i = 0; i < cur_buffer_arena->used; i++) {
                 /* ! (on_free_list | constant | external | sysmem) */
                 if (PObj_buflen(b) && PObj_is_movable_TESTALL(b)) {
@@ -404,7 +404,7 @@
     /* Now we're done. We're already on the pool's free list, so let us be the
      * only one on the free list and free the rest */
     {
-        struct Memory_Block *cur_block, *next_block;
+        Memory_Block *cur_block, *next_block;
 
         assert(new_block == pool->top_block);
         cur_block = new_block->prev;
@@ -489,8 +489,8 @@
 /* XXX FIXME used for hack in string.c*/
 int
 Parrot_in_memory_pool(Interp *interp, void *bufstart) {
-    struct Memory_Pool * const pool = interp->arena_base->memory_pool;
-    struct Memory_Block *cur_block;
+    Memory_Pool * const pool = interp->arena_base->memory_pool;
+    Memory_Block *cur_block;
     cur_block = pool->top_block;
     while (cur_block) {
         if ((char *)bufstart >= cur_block->start &&
@@ -529,7 +529,7 @@
 {
     size_t copysize;
     void *mem;
-    struct Memory_Pool * const pool = interp->arena_base->memory_pool;
+    Memory_Pool * const pool = interp->arena_base->memory_pool;
     size_t new_size, needed, old_size;
 
     /*
@@ -596,7 +596,7 @@
     char *mem, *oldmem;
     size_t new_size, needed, old_size;
 
-    struct Memory_Pool * const pool =
+    Memory_Pool * const pool =
         PObj_constant_TEST(str)
             ? interp->arena_base->constant_string_pool
             : interp->arena_base->memory_pool;
@@ -635,8 +635,8 @@
     mem += sizeof (void*);
 
     /* copy mem from strstart, *not* bufstart */
-    oldmem = str->strstart;
-    str->strstart = PObj_bufstart(str) = mem;
+    oldmem           = str->strstart;
+    str->strstart    = PObj_bufstart(str) = mem;
     PObj_buflen(str) = new_size - sizeof (void*);
 
     /* We shouldn't ever have a 0 from size, but we do. If we can track down
@@ -715,7 +715,7 @@
 Parrot_allocate_string(Interp *interp, STRING *str, size_t size)
 {
     size_t new_size;
-    struct Memory_Pool *pool;
+    Memory_Pool *pool;
     char *mem;
 
     PObj_buflen(str) = 0;
@@ -733,7 +733,7 @@
 
 /*
 
-=item C<static struct Memory_Pool *
+=item C<static Memory_Pool *
 new_memory_pool(size_t min_block, compact_f compact)>
 
 Create a new memory pool.
@@ -742,11 +742,11 @@
 
 */
 
-static struct Memory_Pool *
+static Memory_Pool *
 new_memory_pool(size_t min_block, compact_f compact)
 {
-    struct Memory_Pool * const pool =
-        mem_internal_allocate(sizeof (struct Memory_Pool));
+    Memory_Pool * const pool =
+        (Memory_Pool *)mem_internal_allocate(sizeof (Memory_Pool));
 
     if (pool) {
         pool->top_block = NULL;
@@ -775,7 +775,7 @@
 void
 Parrot_initialize_memory_pools(Interp *interp)
 {
-    struct Arenas * const arena_base = interp->arena_base;
+    Arenas * const arena_base = interp->arena_base;
 
     arena_base->memory_pool = new_memory_pool(POOL_SIZE, &compact_pool);
     alloc_new_block(interp, POOL_SIZE, arena_base->memory_pool, "init");
@@ -804,14 +804,14 @@
     int i;
 
     for (i = 0; i < 2; i++) {
-        struct Memory_Pool * const pool = i ?
+        Memory_Pool * const pool = i ?
                 interp->arena_base->constant_string_pool :
                 interp->arena_base->memory_pool;
-        struct Memory_Block *cur_block;
+        Memory_Block *cur_block;
 
         cur_block = pool->top_block;
         while (cur_block) {
-            struct Memory_Block * const next_block = cur_block->prev;
+            Memory_Block * const next_block = cur_block->prev;
             mem_internal_free(cur_block);
             cur_block = next_block;
         }
@@ -831,10 +831,10 @@
 
 */
 
-static void merge_pools(struct Memory_Pool *dest, struct Memory_Pool *source)
+static void merge_pools(Memory_Pool *dest, Memory_Pool *source)
 {
-    struct Memory_Block *cur_block;
-    struct Memory_Block *next_block;
+    Memory_Block *cur_block;
+    Memory_Block *next_block;
 
     cur_block = source->top_block;
     while (cur_block) {

Modified: trunk/src/gc/smallobject.c
==============================================================================
--- trunk/src/gc/smallobject.c  (original)
+++ trunk/src/gc/smallobject.c  Sat Apr 14 13:50:06 2007
@@ -32,8 +32,7 @@
 /*
 
 =item C<INTVAL
-contained_in_pool(Interp *interp,
-        struct Small_Object_Pool *pool, void *ptr)>
+contained_in_pool(Interp *interp, Small_Object_Pool *pool, void *ptr)>
 
 Returns whether C<pool> contains C<*ptr>.
 
@@ -42,10 +41,9 @@
 */
 
 INTVAL
-contained_in_pool(Interp *interp,
-        struct Small_Object_Pool *pool, void *ptr)
+contained_in_pool(Interp *interp, Small_Object_Pool *pool, void *ptr)
 {
-    struct Small_Object_Arena *arena;
+    Small_Object_Arena *arena;
 
     ptr = PObj_to_ARENA(ptr);
 
@@ -76,8 +74,7 @@
 int
 Parrot_is_const_pmc(Parrot_Interp interp, PMC *pmc)
 {
-    struct Small_Object_Pool * const pool
-        = interp->arena_base->constant_pmc_pool;
+    Small_Object_Pool * const pool = interp->arena_base->constant_pmc_pool;
     int c;
     c = contained_in_pool(interp, pool, pmc);
 
@@ -90,8 +87,7 @@
 /*
 
 =item C<void
-more_traceable_objects(Interp *interp,
-        struct Small_Object_Pool *pool)>
+more_traceable_objects(Interp *interp, Small_Object_Pool *pool)>
 
 We're out of traceable objects. Try a DOD, then get some more if needed.
 
@@ -100,13 +96,12 @@
 */
 
 static void
-more_traceable_objects(Interp *interp,
-        struct Small_Object_Pool *pool)
+more_traceable_objects(Interp *interp, Small_Object_Pool *pool)
 {
     if (pool->skip)
         pool->skip = 0;
     else {
-        struct Small_Object_Arena * const arena = pool->last_Arena;
+        Small_Object_Arena * const arena = pool->last_Arena;
         if (arena) {
             if (arena->used == arena->total_objects)
                 Parrot_do_dod_run(interp, DOD_trace_stack_FLAG);
@@ -126,14 +121,12 @@
 /*
 
 =item C<static void
-gc_ms_add_free_object(Interp *interp,
-        struct Small_Object_Pool *pool, void *to_add)>
+gc_ms_add_free_object(Interp *interp, Small_Object_Pool *pool, void *to_add)>
 
 Add an unused object back to the free pool for later reuse.
 
 =item C<static void *
-gc_ms_get_free_object(Interp *interp,
-        struct Small_Object_Pool *pool)>
+gc_ms_get_free_object(Interp *interp, Small_Object_Pool *pool)>
 
 Get a new object from the free pool and return it.
 
@@ -142,8 +135,7 @@
 */
 
 static void
-gc_ms_add_free_object(Interp *interp,
-        struct Small_Object_Pool *pool, void *to_add)
+gc_ms_add_free_object(Interp *interp, Small_Object_Pool *pool, void *to_add)
 {
     *(void **)to_add = pool->free_list;
     pool->free_list = to_add;
@@ -151,8 +143,7 @@
 
 
 static void *
-gc_ms_get_free_object(Interp *interp,
-        struct Small_Object_Pool *pool)
+gc_ms_get_free_object(Interp *interp, Small_Object_Pool *pool)
 {
     void *ptr;
 
@@ -170,8 +161,8 @@
 
 =item C< void
 Parrot_add_to_free_list(Interp *interp,
-        struct Small_Object_Pool *pool,
-        struct Small_Object_Arena *arena,
+        Small_Object_Pool *pool,
+        Small_Object_Arena *arena,
         UINTVAL start,
         UINTVAL end)>
 
@@ -183,8 +174,8 @@
 
 void
 Parrot_add_to_free_list(Interp *interp,
-        struct Small_Object_Pool *pool,
-        struct Small_Object_Arena *arena,
+        Small_Object_Pool *pool,
+        Small_Object_Arena *arena,
         UINTVAL start,
         UINTVAL end)
 {
@@ -214,8 +205,8 @@
  * insert the new arena into the pool's structure, update stats
  */
 void
-Parrot_append_arena_in_pool(Interp *interp, struct Small_Object_Pool *pool,
-    struct Small_Object_Arena *new_arena, size_t size)
+Parrot_append_arena_in_pool(Interp *interp, Small_Object_Pool *pool,
+    Small_Object_Arena *new_arena, size_t size)
 {
 
     /* Maintain the *_arena_memory invariant for stack walking code. Set it
@@ -240,8 +231,7 @@
 /*
 
 =item C<static void
-gc_ms_alloc_objects(Interp *interp,
-        struct Small_Object_Pool *pool)>
+gc_ms_alloc_objects(Interp *interp, Small_Object_Pool *pool)>
 
 We have no more headers on the free header pool. Go allocate more
 and put them on.
@@ -251,14 +241,15 @@
 */
 
 static void
-gc_ms_alloc_objects(Interp *interp, struct Small_Object_Pool *pool)
+gc_ms_alloc_objects(Interp *interp, Small_Object_Pool *pool)
 {
-    struct Small_Object_Arena *new_arena;
+    Small_Object_Arena *new_arena;
     size_t size;
     UINTVAL start, end;
 
     /* Setup memory for the new objects */
-    new_arena = mem_internal_allocate(sizeof (struct Small_Object_Arena));
+    new_arena = (Small_Object_Arena *)mem_internal_allocate(
+        sizeof (Small_Object_Arena));
     if (!new_arena)
         PANIC("Out of arena memory");
     size = pool->object_size * pool->objects_per_alloc;
@@ -294,7 +285,7 @@
 
 /*
 
-=item C<struct Small_Object_Pool *
+=item C<Small_Object_Pool *
 new_small_object_pool(Interp *interp,
         size_t object_size, size_t objects_per_alloc)>
 
@@ -305,23 +296,26 @@
 */
 
 
-struct Small_Object_Pool *
+Small_Object_Pool *
 new_small_object_pool(Interp *interp,
         size_t object_size, size_t objects_per_alloc)
 {
-    struct Small_Object_Pool * const pool =
-        mem_internal_allocate_zeroed(sizeof (struct Small_Object_Pool));
+    Small_Object_Pool * const pool =
+        (Small_Object_Pool * const)mem_internal_allocate_zeroed(
+            sizeof (Small_Object_Pool));
 
     SET_NULL(pool->last_Arena);
     SET_NULL(pool->free_list);
     SET_NULL(pool->mem_pool);
-    pool->object_size = object_size;
+
+    pool->object_size       = object_size;
     pool->objects_per_alloc = objects_per_alloc;
+
     return pool;
 }
 
 void
-gc_pmc_ext_pool_init(Interp *interp, struct Small_Object_Pool *pool)
+gc_pmc_ext_pool_init(Interp *interp, Small_Object_Pool *pool)
 {
     pool->add_free_object = gc_ms_add_free_object;
     pool->get_free_object = gc_ms_get_free_object;
@@ -330,7 +324,7 @@
 }
 
 static void
-gc_ms_pool_init(Interp *interp, struct Small_Object_Pool *pool)
+gc_ms_pool_init(Interp *interp, Small_Object_Pool *pool)
 {
     pool->add_free_object = gc_ms_add_free_object;
     pool->get_free_object = gc_ms_get_free_object;
@@ -354,7 +348,7 @@
 void
 Parrot_gc_ms_init(Interp *interp)
 {
-    struct Arenas * const arena_base = interp->arena_base;
+    Arenas * const arena_base = interp->arena_base;
 
     arena_base->do_dod_run = Parrot_dod_ms_run;
     arena_base->de_init_gc_system = (void (*)(Interp*)) NULLfunc;
@@ -365,7 +359,7 @@
 
 =item C<void
 Parrot_small_object_pool_merge(Interp *interp,
-            struct Small_Object_Pool *dest, struct Small_Object_Pool *source)>
+            Small_Object_Pool *dest, Small_Object_Pool *source)>
 
 Merge C<source> into C<dest>.
 
@@ -375,9 +369,9 @@
 
 void
 Parrot_small_object_pool_merge(Interp *interp,
-        struct Small_Object_Pool *dest, struct Small_Object_Pool *source) {
-    struct Small_Object_Arena *cur_arena;
-    struct Small_Object_Arena *next_arena;
+        Small_Object_Pool *dest, Small_Object_Pool *source) {
+    Small_Object_Arena *cur_arena;
+    Small_Object_Arena *next_arena;
     void **free_list_end;
 
     /* XXX num_free_objects doesn't seem to be accounted correctly in, e.g.,
@@ -400,7 +394,7 @@
     /* XXX this won't work with, e.g., gc_gms */
     free_list_end = &dest->free_list;
     while (*free_list_end) {
-        free_list_end = *free_list_end;
+        free_list_end = (void **)*free_list_end;
     }
     *free_list_end = source->free_list;
 

Modified: trunk/src/headers.c
==============================================================================
--- trunk/src/headers.c (original)
+++ trunk/src/headers.c Sat Apr 14 13:50:06 2007
@@ -37,8 +37,7 @@
 =over 4
 
 =item C<static void *
-get_free_buffer(Interp *interp,
-        struct Small_Object_Pool *pool)>
+get_free_buffer(Interp *interp, Small_Object_Pool *pool)>
 
 Gets a free C<Buffer> from C<pool> and returns it. Memory is cleared.
 
@@ -47,8 +46,7 @@
 */
 
 static void *
-get_free_buffer(Interp *interp,
-        struct Small_Object_Pool *pool)
+get_free_buffer(Interp *interp, Small_Object_Pool *pool)
 {
     PObj *buffer = pool->get_free_object(interp, pool);
 
@@ -70,8 +68,7 @@
 
 =over 4
 
-=item C<struct Small_Object_Pool *
-new_pmc_pool(Interp *interp)>
+=item C<Small_Object_Pool * new_pmc_pool(Interp *interp)>
 
 Creates an new pool for PMCs and returns it.
 
@@ -79,11 +76,10 @@
 
 */
 
-struct Small_Object_Pool *
-new_pmc_pool(Interp *interp)
+Small_Object_Pool * new_pmc_pool(Interp *interp)
 {
     int num_headers = PMC_HEADERS_PER_ALLOC;
-    struct Small_Object_Pool *pmc_pool =
+    Small_Object_Pool *pmc_pool =
         new_small_object_pool(interp, sizeof (PMC), num_headers);
 
     pmc_pool->mem_pool = NULL;
@@ -93,9 +89,8 @@
 
 /*
 
-=item C<struct Small_Object_Pool *
-new_bufferlike_pool(Interp *interp,
-        size_t actual_buffer_size)>
+=item C<Small_Object_Pool *
+new_bufferlike_pool(Interp *interp, size_t actual_buffer_size)>
 
 Creates a new pool for buffer-like structures. Usually you would need
 C<make_bufferlike_pool()>.
@@ -104,14 +99,14 @@
 
 */
 
-struct Small_Object_Pool *
+Small_Object_Pool *
 new_bufferlike_pool(Interp *interp,
         size_t actual_buffer_size)
 {
     int num_headers = BUFFER_HEADERS_PER_ALLOC;
     size_t buffer_size =
             (actual_buffer_size + sizeof (void *) - 1) & ~(sizeof (void *) - 
1);
-    struct Small_Object_Pool *pool =
+    Small_Object_Pool *pool =
             new_small_object_pool(interp, buffer_size, num_headers);
 
     pool->mem_pool = interp->arena_base->memory_pool;
@@ -121,7 +116,7 @@
 
 /*
 
-=item C<struct Small_Object_Pool *
+=item C<Small_Object_Pool *
 new_buffer_pool(Interp *interp)>
 
 Non-constant strings and plain Buffers are in the sized header pools.
@@ -130,7 +125,7 @@
 
 */
 
-struct Small_Object_Pool *
+Small_Object_Pool *
 new_buffer_pool(Interp *interp)
 {
     return make_bufferlike_pool(interp, sizeof (Buffer));
@@ -138,7 +133,7 @@
 
 /*
 
-=item C<struct Small_Object_Pool *
+=item C<Small_Object_Pool *
 new_string_pool(Interp *interp, INTVAL constant)>
 
 Creates a new pool for C<STRINGS> and returns it.
@@ -147,10 +142,10 @@
 
 */
 
-struct Small_Object_Pool *
+Small_Object_Pool *
 new_string_pool(Interp *interp, INTVAL constant)
 {
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
     if (constant) {
         pool = new_bufferlike_pool(interp, sizeof (STRING));
         pool->mem_pool = interp->arena_base->constant_string_pool;
@@ -163,7 +158,7 @@
 
 /*
 
-=item C<struct Small_Object_Pool *
+=item C<Small_Object_Pool *
 make_bufferlike_pool(Interp *interp, size_t buffer_size)>
 
 Make and return a bufferlike header pool.
@@ -172,12 +167,12 @@
 
 */
 
-struct Small_Object_Pool *
+Small_Object_Pool *
 make_bufferlike_pool(Interp *interp, size_t buffer_size)
 {
     UINTVAL idx;
     UINTVAL num_old = interp->arena_base->num_sized;
-    struct Small_Object_Pool **sized_pools =
+    Small_Object_Pool **sized_pools =
             interp->arena_base->sized_header_pools;
 
     idx = (buffer_size - sizeof (Buffer)) / sizeof (void *);
@@ -202,7 +197,7 @@
 
 /*
 
-=item C<struct Small_Object_Pool *
+=item C<Small_Object_Pool *
 get_bufferlike_pool(Interp *interp, size_t buffer_size)>
 
 Return a bufferlike header pool, it must exist.
@@ -211,10 +206,10 @@
 
 */
 
-struct Small_Object_Pool *
+Small_Object_Pool *
 get_bufferlike_pool(Interp *interp, size_t buffer_size)
 {
-    struct Small_Object_Pool **sized_pools =
+    Small_Object_Pool **sized_pools =
             interp->arena_base->sized_header_pools;
 
     return sized_pools[ (buffer_size - sizeof (Buffer)) / sizeof (void *) ];
@@ -236,7 +231,7 @@
 PMC *
 new_pmc_header(Interp *interp, UINTVAL flags)
 {
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
     PMC *pmc;
 
     pool = flags & PObj_constant_FLAG ?
@@ -275,7 +270,7 @@
 static PMC_EXT *
 new_pmc_ext(Interp *interp)
 {
-    struct Small_Object_Pool *pool = interp->arena_base->pmc_ext_pool;
+    Small_Object_Pool *pool = interp->arena_base->pmc_ext_pool;
     void *ptr;
     /*
      * can't use normal get_free_object--PMC_EXT doesn't have flags
@@ -394,7 +389,7 @@
 void *
 new_bufferlike_header(Interp *interp, size_t size)
 {
-    struct Small_Object_Pool *pool;
+    Small_Object_Pool *pool;
 
     pool = get_bufferlike_pool(interp, size);
 
@@ -417,7 +412,7 @@
 {
     UINTVAL i;
     size_t max = 0;
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
 
     for (i = 0; i < arena_base->num_sized; i++) {
         if (arena_base->sized_header_pools[i]) {
@@ -444,7 +439,7 @@
 get_min_buffer_address(Interp *interp)
 {
     UINTVAL i;
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     size_t min = (size_t) -1;
 
     for (i = 0; i < arena_base->num_sized; i++) {
@@ -506,7 +501,7 @@
 is_buffer_ptr(Interp *interp, void *ptr)
 {
     UINTVAL i;
-    struct Arenas *arena_base = interp->arena_base;;
+    Arenas *arena_base = interp->arena_base;;
 
     for (i = 0; i < arena_base->num_sized; i++) {
         if (arena_base->sized_header_pools[i] &&
@@ -551,7 +546,7 @@
 void
 Parrot_initialize_header_pools(Interp *interp)
 {
-    struct Arenas *arena_base;
+    Arenas *arena_base;
 
     arena_base = interp->arena_base;
     /* Init the constant string header pool */
@@ -633,8 +628,8 @@
 Parrot_forall_header_pools(Interp *interp, int flag, void *arg,
         pool_iter_fn func)
 {
-    struct Small_Object_Pool *pool;
-    struct Arenas *arena_base;
+    Small_Object_Pool *pool;
+    Arenas *arena_base;
     int ret_val, i;
 
     arena_base = interp->arena_base;
@@ -681,9 +676,9 @@
 */
 
 static void
-free_pool(Interp *interp, struct Small_Object_Pool *pool)
+free_pool(Interp *interp, Small_Object_Pool *pool)
 {
-    struct Small_Object_Arena *cur_arena, *next;
+    Small_Object_Arena *cur_arena, *next;
     for (cur_arena = pool->last_Arena; cur_arena;) {
         next = cur_arena->prev;
         mem_internal_free(cur_arena->start_objects);
@@ -694,7 +689,7 @@
 }
 
 static int
-sweep_cb_buf(Interp *interp, struct Small_Object_Pool *pool, int flag,
+sweep_cb_buf(Interp *interp, Small_Object_Pool *pool, int flag,
         void *arg)
 {
     int pass = (int)(INTVAL)arg;
@@ -715,7 +710,7 @@
 }
 
 static int
-sweep_cb_pmc(Interp *interp, struct Small_Object_Pool *pool, int flag,
+sweep_cb_pmc(Interp *interp, Small_Object_Pool *pool, int flag,
         void *arg)
 {
     Parrot_dod_sweep(interp, pool);
@@ -760,10 +755,9 @@
 =cut
 */
 
-static void fix_pmc_syncs(Interp *dest_interp,
-        struct Small_Object_Pool *pool) {
+static void fix_pmc_syncs(Interp *dest_interp, Small_Object_Pool *pool) {
     /* XXX largely copied from dod_sweep */
-    struct Small_Object_Arena *cur_arena;
+    Small_Object_Arena *cur_arena;
     UINTVAL object_size = pool->object_size;
     size_t i;
     size_t nm;
@@ -796,8 +790,8 @@
 
 void
 Parrot_merge_header_pools(Interp *dest_interp, Interp *source_interp) {
-    struct Arenas *dest_arena;
-    struct Arenas *source_arena;
+    Arenas *dest_arena;
+    Arenas *source_arena;
     UINTVAL i;
 
     dest_arena = dest_interp->arena_base;

Modified: trunk/src/inter_misc.c
==============================================================================
--- trunk/src/inter_misc.c      (original)
+++ trunk/src/inter_misc.c      Sat Apr 14 13:50:06 2007
@@ -213,7 +213,7 @@
 {
     INTVAL ret = 0;
     int j;
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
 
     switch (what) {
         case TOTAL_MEM_ALLOC:
@@ -240,7 +240,7 @@
         case ACTIVE_BUFFERS:
             ret = 0;
             for (j = 0; j < (INTVAL)arena_base->num_sized; j++) {
-                struct Small_Object_Pool * const header_pool =
+                Small_Object_Pool * const header_pool =
                     arena_base->sized_header_pools[j];
                 if (header_pool)
                     ret += header_pool->total_objects -
@@ -253,7 +253,7 @@
         case TOTAL_BUFFERS:
             ret = 0;
             for (j = 0; j < (INTVAL)arena_base->num_sized; j++) {
-                struct Small_Object_Pool * const header_pool =
+                Small_Object_Pool * const header_pool =
                     arena_base->sized_header_pools[j];
                 if (header_pool)
                     ret += header_pool->total_objects;

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c     (original)
+++ trunk/src/pmc.c     Sat Apr 14 13:50:06 2007
@@ -127,7 +127,7 @@
             /* if the PMC has a PMC_EXT structure,
              * return it to the pool/arena
              */
-            struct Small_Object_Pool * const ext_pool =
+            Small_Object_Pool * const ext_pool =
                 interp->arena_base->pmc_ext_pool;
             if (PObj_is_PMC_shared_TEST(pmc) && PMC_sync(pmc)) {
                 MUTEX_DESTROY(PMC_sync(pmc)->pmc_lock);
@@ -450,7 +450,7 @@
          * return it to the pool/arena
          * we don't need it - basically only the vtable is important
          */
-        struct Small_Object_Pool * const ext_pool =
+        Small_Object_Pool * const ext_pool =
             interp->arena_base->pmc_ext_pool;
         if (PMC_sync(class))
             mem_internal_free(PMC_sync(class));

Modified: trunk/src/pmc/retcontinuation.pmc
==============================================================================
--- trunk/src/pmc/retcontinuation.pmc   (original)
+++ trunk/src/pmc/retcontinuation.pmc   Sat Apr 14 13:50:06 2007
@@ -93,8 +93,8 @@
         /* the continuation is dead - delete and destroy it */
         mem_sys_free(cc);
         {
-            struct Arenas *arena_base = interp->arena_base;
-            struct Small_Object_Pool *pool, *ext_pool =
+            Arenas *arena_base = interp->arena_base;
+            Small_Object_Pool *pool, *ext_pool =
                 arena_base->pmc_ext_pool;
             ext_pool->add_free_object(interp, ext_pool,
                     SELF->pmc_ext);

Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c      (original)
+++ trunk/src/pmc_freeze.c      Sat Apr 14 13:50:06 2007
@@ -575,8 +575,7 @@
 /*
 
 =item C<static void
-cleanup_next_for_GC_pool(Parrot_Interp interp,
-    struct Small_Object_Pool *pool)>
+cleanup_next_for_GC_pool(Parrot_Interp interp, Small_Object_Pool *pool)>
 
 Sets all the C<next_for_GC> pointers to C<NULL>.
 
@@ -585,10 +584,9 @@
 */
 
 static void
-cleanup_next_for_GC_pool(Parrot_Interp interp,
-    struct Small_Object_Pool *pool)
+cleanup_next_for_GC_pool(Parrot_Interp interp, Small_Object_Pool *pool)
 {
-    struct Small_Object_Arena *arena;
+    Small_Object_Arena *arena;
 
     for (arena = pool->last_Arena; arena; arena = arena->prev) {
         PMC *p = arena->start_objects;
@@ -999,8 +997,8 @@
 id_from_pmc(Parrot_Interp interp, PMC* pmc)
 {
     UINTVAL id = 1;     /* first PMC in first arena */
-    struct Small_Object_Arena *arena;
-    struct Small_Object_Pool *pool;
+    Small_Object_Arena *arena;
+    Small_Object_Pool *pool;
     ptrdiff_t ptr_diff;
 
     pmc = (PMC*)PObj_to_ARENA(pmc);

Modified: trunk/src/runops_cores.c
==============================================================================
--- trunk/src/runops_cores.c    (original)
+++ trunk/src/runops_cores.c    Sat Apr 14 13:50:06 2007
@@ -109,7 +109,7 @@
 runops_trace_core(Interp *interp, opcode_t *pc)
 {
     static size_t dod, gc;
-    struct Arenas *arena_base = interp->arena_base;
+    Arenas *arena_base = interp->arena_base;
     Interp *debugger;
     PMC* pio;
 

Modified: trunk/src/stack_common.c
==============================================================================
--- trunk/src/stack_common.c    (original)
+++ trunk/src/stack_common.c    Sat Apr 14 13:50:06 2007
@@ -84,7 +84,7 @@
 Stack_Chunk_t *cst_new_stack_chunk(Parrot_Interp interp,
                                    const Stack_Chunk_t *chunk /*NN*/)
 {
-    struct Small_Object_Pool * const pool =
+    Small_Object_Pool * const pool =
         get_bufferlike_pool(interp, chunk->size);
     Stack_Chunk_t * const new_chunk = pool->get_free_object(interp, pool);
 

Reply via email to