[svn:parrot] r38622 - branches/gc_api/include/parrot

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sat May 9 00:24:23 UTC 2009


Author: whiteknight
Date: Sat May  9 00:24:23 2009
New Revision: 38622
URL: https://trac.parrot.org/parrot/changeset/38622

Log:
[gc_api] move all the guts of gc_mark_sweep.h into gc_api.h, preparing to delete the former

Modified:
   branches/gc_api/include/parrot/gc_api.h
   branches/gc_api/include/parrot/gc_mark_sweep.h

Modified: branches/gc_api/include/parrot/gc_api.h
==============================================================================
--- branches/gc_api/include/parrot/gc_api.h	Sat May  9 00:17:36 2009	(r38621)
+++ branches/gc_api/include/parrot/gc_api.h	Sat May  9 00:24:23 2009	(r38622)
@@ -66,8 +66,6 @@
     FLOATVAL reclaim_factor; /* minimum percentage we will reclaim */
 } Memory_Pool;
 
-
-
 typedef struct Arenas {
     Memory_Pool *memory_pool;
     Memory_Pool *constant_string_pool;
@@ -129,6 +127,137 @@
     void *  gc_private;           /* gc subsystem data */
 } Arenas;
 
+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;
+
+typedef enum {
+    GC_TRACE_FULL,
+    GC_TRACE_ROOT_ONLY,
+    GC_TRACE_SYSTEM_ONLY
+} Parrot_gc_trace_type;
+
+typedef void (*add_free_object_fn_type)(PARROT_INTERP, struct Small_Object_Pool *, void *);
+typedef void * (*get_free_object_fn_type)(PARROT_INTERP, struct Small_Object_Pool *);
+typedef void (*alloc_objects_fn_type)(PARROT_INTERP, struct Small_Object_Pool *);
+typedef void (*gc_object_fn_type)(PARROT_INTERP, struct Small_Object_Pool *, PObj *);
+
+#if PARROT_GC_GMS
+/*
+ * all objects have this header in front of the actual
+ * object pointer. The prev/next pointers chain all existing
+ * objects for one pool (sizeclass) together.
+ *
+ * XXX this could lead to unaligned FLOATVALs in the adjacent PMC
+ *     if that's true either insert a dummy or reorder PMC members
+ *     ??? How is that possible?
+ */
+typedef struct _gc_gms_hdr {
+    struct _gc_gms_hdr *prev;
+    struct _gc_gms_hdr *next;
+    struct _gc_gms_gen *gen;
+    void *gc_dummy_align;       /* see above */
+} Gc_gms_hdr;
+
+#  define PObj_to_GMSH(o) (((Gc_gms_hdr*)(o))-1)
+#  define GMSH_to_PObj(p) ((PObj*) ((p)+1))
+
+/* the structure uses 2 ptrs itself */
+#  define GC_GMS_STORE_SIZE (64-2)
+
+typedef struct _gc_gms_hdr_store {
+    struct _gc_gms_hdr_store *next;
+    Gc_gms_hdr **ptr;                           /* insert location */
+    Gc_gms_hdr * (store[GC_GMS_STORE_SIZE]);    /* array of hdr pointers */
+} Gc_gms_hdr_store;
+
+typedef struct _gc_gms_hdr_list {
+    Gc_gms_hdr_store *first;
+    Gc_gms_hdr_store *last;
+} Gc_gms_hdr_list;
+
+
+/*
+ * all objects belong to one generation
+ */
+typedef struct _gc_gms_gen {
+    UINTVAL gen_no;                     /* generation number */
+    UINTVAL timely_destruct_obj_sofar;  /* sum up to this generation */
+    UINTVAL black_color;                /* live color of this generation */
+    struct _gc_gms_hdr *first;          /* first header in this generation */
+    struct _gc_gms_hdr *last;           /* last header in this generation */
+    struct _gc_gms_hdr *fin;            /* need destruction/finalization */
+    struct Small_Object_Pool *pool;     /* where this generation belongs to */
+    Gc_gms_hdr_list igp;                /* IGPs for this generation */
+    UINTVAL n_possibly_dead;            /* overwritten count */
+    UINTVAL n_objects;                  /* live objects count */
+    struct _gc_gms_gen *prev;
+    struct _gc_gms_gen *next;
+} Gc_gms_gen;
+
+#endif /* PARROT_GC_GMS */
+
+/* Tracked resource pool */
+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.
+     */
+    size_t object_size;
+    size_t objects_per_alloc;
+    size_t total_objects;
+    size_t num_free_objects;    /* number of resources in the free pool */
+    int skip;
+    size_t replenish_level;
+    void *free_list;
+    /* adds a free object to the pool's free list  */
+    add_free_object_fn_type     add_free_object;
+    get_free_object_fn_type     get_free_object;
+    alloc_objects_fn_type       alloc_objects;
+    alloc_objects_fn_type       more_objects;
+    gc_object_fn_type           gc_object;
+    /* gets and removes a free object from the pool's free list */
+    /* allocates more objects */
+    struct Memory_Pool *mem_pool;
+    size_t start_arena_memory;
+    size_t end_arena_memory;
+    const char *name;
+#if PARROT_GC_GMS
+    struct _gc_gms_hdr marker;          /* limit of list */
+    struct _gc_gms_hdr *black;          /* alive */
+    struct _gc_gms_hdr *black_fin;      /* alive, needs destruction */
+    struct _gc_gms_hdr *gray;           /* to be scanned */
+    struct _gc_gms_hdr *white;          /* unprocessed */
+    struct _gc_gms_hdr *white_fin;      /* unprocesse, needs destruction */
+
+    struct _gc_gms_gen *first_gen;      /* linked list of generations */
+    struct _gc_gms_gen *last_gen;
+
+#endif
+} Small_Object_Pool;
+
+/*
+ * macros used in arena scan code to convert from object pointers
+ * to arena pointers ...
+ */
+
+#if PARROT_GC_GMS
+#  define GC_HEADER_SIZE (sizeof (Gc_gms_hdr))
+#  define PObj_to_ARENA(o) PObj_to_GMSH(o)
+#  define ARENA_to_PObj(p) GMSH_to_PObj((Gc_gms_hdr*)(p))
+#else
+#  define GC_HEADER_SIZE 0
+#  define PObj_to_ARENA(o) (o)
+#  define ARENA_to_PObj(p) (p)
+#endif
+
 /* &gen_from_enum(interpinfo.pasm) prefix(INTERPINFO_) */
 
 typedef enum {

Modified: branches/gc_api/include/parrot/gc_mark_sweep.h
==============================================================================
--- branches/gc_api/include/parrot/gc_mark_sweep.h	Sat May  9 00:17:36 2009	(r38621)
+++ branches/gc_api/include/parrot/gc_mark_sweep.h	Sat May  9 00:24:23 2009	(r38622)
@@ -8,136 +8,7 @@
 
 #  include "parrot/parrot.h"
 
-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;
-
-typedef enum {
-    GC_TRACE_FULL,
-    GC_TRACE_ROOT_ONLY,
-    GC_TRACE_SYSTEM_ONLY
-} Parrot_gc_trace_type;
-
-typedef void (*add_free_object_fn_type)(PARROT_INTERP, struct Small_Object_Pool *, void *);
-typedef void * (*get_free_object_fn_type)(PARROT_INTERP, struct Small_Object_Pool *);
-typedef void (*alloc_objects_fn_type)(PARROT_INTERP, struct Small_Object_Pool *);
-typedef void (*gc_object_fn_type)(PARROT_INTERP, struct Small_Object_Pool *, PObj *);
-
-#if PARROT_GC_GMS
-/*
- * all objects have this header in front of the actual
- * object pointer. The prev/next pointers chain all existing
- * objects for one pool (sizeclass) together.
- *
- * XXX this could lead to unaligned FLOATVALs in the adjacent PMC
- *     if that's true either insert a dummy or reorder PMC members
- *     ??? How is that possible?
- */
-typedef struct _gc_gms_hdr {
-    struct _gc_gms_hdr *prev;
-    struct _gc_gms_hdr *next;
-    struct _gc_gms_gen *gen;
-    void *gc_dummy_align;       /* see above */
-} Gc_gms_hdr;
-
-#  define PObj_to_GMSH(o) (((Gc_gms_hdr*)(o))-1)
-#  define GMSH_to_PObj(p) ((PObj*) ((p)+1))
-
-/* the structure uses 2 ptrs itself */
-#  define GC_GMS_STORE_SIZE (64-2)
-
-typedef struct _gc_gms_hdr_store {
-    struct _gc_gms_hdr_store *next;
-    Gc_gms_hdr **ptr;                           /* insert location */
-    Gc_gms_hdr * (store[GC_GMS_STORE_SIZE]);    /* array of hdr pointers */
-} Gc_gms_hdr_store;
-
-typedef struct _gc_gms_hdr_list {
-    Gc_gms_hdr_store *first;
-    Gc_gms_hdr_store *last;
-} Gc_gms_hdr_list;
-
-
-/*
- * all objects belong to one generation
- */
-typedef struct _gc_gms_gen {
-    UINTVAL gen_no;                     /* generation number */
-    UINTVAL timely_destruct_obj_sofar;  /* sum up to this generation */
-    UINTVAL black_color;                /* live color of this generation */
-    struct _gc_gms_hdr *first;          /* first header in this generation */
-    struct _gc_gms_hdr *last;           /* last header in this generation */
-    struct _gc_gms_hdr *fin;            /* need destruction/finalization */
-    struct Small_Object_Pool *pool;     /* where this generation belongs to */
-    Gc_gms_hdr_list igp;                /* IGPs for this generation */
-    UINTVAL n_possibly_dead;            /* overwritten count */
-    UINTVAL n_objects;                  /* live objects count */
-    struct _gc_gms_gen *prev;
-    struct _gc_gms_gen *next;
-} Gc_gms_gen;
-
-#endif /* PARROT_GC_GMS */
-
-/* Tracked resource pool */
-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.
-     */
-    size_t object_size;
-    size_t objects_per_alloc;
-    size_t total_objects;
-    size_t num_free_objects;    /* number of resources in the free pool */
-    int skip;
-    size_t replenish_level;
-    void *free_list;
-    /* adds a free object to the pool's free list  */
-    add_free_object_fn_type     add_free_object;
-    get_free_object_fn_type     get_free_object;
-    alloc_objects_fn_type       alloc_objects;
-    alloc_objects_fn_type       more_objects;
-    gc_object_fn_type           gc_object;
-    /* gets and removes a free object from the pool's free list */
-    /* allocates more objects */
-    struct Memory_Pool *mem_pool;
-    size_t start_arena_memory;
-    size_t end_arena_memory;
-    const char *name;
-#if PARROT_GC_GMS
-    struct _gc_gms_hdr marker;          /* limit of list */
-    struct _gc_gms_hdr *black;          /* alive */
-    struct _gc_gms_hdr *black_fin;      /* alive, needs destruction */
-    struct _gc_gms_hdr *gray;           /* to be scanned */
-    struct _gc_gms_hdr *white;          /* unprocessed */
-    struct _gc_gms_hdr *white_fin;      /* unprocesse, needs destruction */
-
-    struct _gc_gms_gen *first_gen;      /* linked list of generations */
-    struct _gc_gms_gen *last_gen;
-
-#endif
-} Small_Object_Pool;
-
-/*
- * macros used in arena scan code to convert from object pointers
- * to arena pointers ...
- */
-
-#if PARROT_GC_GMS
-#  define GC_HEADER_SIZE (sizeof (Gc_gms_hdr))
-#  define PObj_to_ARENA(o) PObj_to_GMSH(o)
-#  define ARENA_to_PObj(p) GMSH_to_PObj((Gc_gms_hdr*)(p))
-#else
-#  define GC_HEADER_SIZE 0
-#  define PObj_to_ARENA(o) (o)
-#  define ARENA_to_PObj(p) (p)
-#endif
 
 #endif /* PARROT_GC_MARK_SWEEP_H_GUARD */
 


More information about the parrot-commits mailing list