Author: heimdall
Date: Sat Aug  6 16:07:53 2005
New Revision: 8850

Added:
   branches/gmc/src/gc_gmc.c
Modified:
   branches/gmc/include/parrot/headers.h
   branches/gmc/include/parrot/resources.h
   branches/gmc/src/headers.c
Log:
New pool in arena_base for pmc_bodies.
pmc_body is alloced in headers.c but the corresponding gmc functions are not 
yet there.


Modified: branches/gmc/include/parrot/headers.h
==============================================================================
--- branches/gmc/include/parrot/headers.h       (original)
+++ branches/gmc/include/parrot/headers.h       Sat Aug  6 16:07:53 2005
@@ -47,6 +47,7 @@ int is_buffer_ptr(Interp *, void *);
 int is_pmc_ptr(Interp *, void *);
 
 void gc_pmc_ext_pool_init(Interp *, struct Small_Object_Pool *pool);
+void gc_pmc_body_pool_init(Interp *, struct Small_Object_Pool *pool);
 
 /* pool iteration */
 typedef enum {

Modified: branches/gmc/include/parrot/resources.h
==============================================================================
--- branches/gmc/include/parrot/resources.h     (original)
+++ branches/gmc/include/parrot/resources.h     Sat Aug  6 16:07:53 2005
@@ -57,6 +57,9 @@ struct Arenas {
     struct Small_Object_Pool *string_header_pool;
     struct Small_Object_Pool *pmc_pool;
     struct Small_Object_Pool *pmc_ext_pool;
+#if PARROT_GC_GMC
+    struct Small_Object_Pool *pmc_body_pool;
+#endif
     struct Small_Object_Pool *constant_pmc_pool;
     struct Small_Object_Pool *buffer_header_pool;
     struct Small_Object_Pool *constant_string_header_pool;

Added: branches/gmc/src/gc_gmc.c
==============================================================================
--- (empty file)
+++ branches/gmc/src/gc_gmc.c   Sat Aug  6 16:07:53 2005
@@ -0,0 +1,36 @@
+#include <parrot/parrot.h>
+
+#if PARROT_GC_GMC
+
+static void gc_gmc_pool_init(Interp *interpreter, struct Small_Object_Pool 
*pool) 
+{
+
+}
+
+static void gc_gmc_deinit(Interp *interpreter)
+{
+
+}
+
+static void gc_gmc_run(Interp *interpreter, int flags)
+{
+
+}
+
+void Parrot_gc_gmc_init(Interp *interpreter)
+{
+  struct Arenas *arena_base;
+
+  arena_base = interpreter->arena_base;
+
+  arena_base->do_dod_run = gc_gmc_run;
+  arena_base->de_init_gc_system = gc_gmc_deinit;
+  arena_base->init_pool = gc_gmc_pool_init;
+}
+
+void gc_pmc_body_pool_init(Interp *interpreter, struct Small_Object_Pool *pool)
+{
+
+}
+
+#endif /* PARROT_GC_GMC */

Modified: branches/gmc/src/headers.c
==============================================================================
--- branches/gmc/src/headers.c  (original)
+++ branches/gmc/src/headers.c  Sat Aug  6 16:07:53 2005
@@ -227,7 +227,6 @@ get_bufferlike_pool(Interp *interpreter,
     return sized_pools[ (buffer_size - sizeof(Buffer)) / sizeof(void *) ];
 }
 
-
 /*
 
 =item C<PMC *
@@ -239,6 +238,10 @@ Get a header.
 
 */
 
+#if PARROT_GC_GMC
+static pmc_body * new_pmc_body(Parrot_Interp);
+#endif
+
 static PMC_EXT * new_pmc_ext(Parrot_Interp);
 
 PMC *
@@ -276,9 +279,46 @@ new_pmc_header(Interp *interpreter, UINT
 #if ! PMC_DATA_IN_EXT
     PMC_data(pmc) = NULL;
 #endif
+#if PARROT_GC_GMC
+    pmc->body = new_pmc_body(interpreter);
+#endif
     return pmc;
 }
 
+
+
+#if PARROT_GC_GMC
+
+/* 
+
+=item C<void *
+new_pmc_body(Interp *interpreter)>
+
+Allocates a pmc_body.
+Basically same as new_pmc_ext.
+
+=cut
+
+*/
+
+static pmc_body *
+new_pmc_body(Interp *interpreter)
+{
+    struct Small_Object_Pool *pool = interpreter->arena_base->pmc_ext_pool;
+    void *ptr;
+
+    if (!pool->free_list)
+        (*pool->more_objects) (interpreter, pool);
+    ptr = pool->free_list;
+    pool->free_list = *(void **)ptr;
+    memset(ptr, 0, sizeof(pmc_body));
+    return ptr;
+}
+
+#endif /* PARROT_GC_GMC */
+
+
+
 /*
 
 =item C<PMC_EXT *
@@ -592,6 +632,14 @@ Parrot_initialize_header_pools(Interp *i
     gc_pmc_ext_pool_init(interpreter, arena_base->pmc_ext_pool);
     arena_base->pmc_ext_pool->name = "pmc_ext";
 
+#if PARROT_GC_GMC
+    /*
+     * pmc_body is gmc specific, so use functions of src/gmc.c.
+     */
+    gc_pmc_body_pool_init(interpreter, arena_base->pmc_body_pool);
+    arena_base->pmc_body_pool->name = "pmc_body";
+#endif
+
     /* constant PMCs */
     arena_base->constant_pmc_pool = new_pmc_pool(interpreter);
     arena_base->constant_pmc_pool->name = "constant_pmc";

Reply via email to