perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r29894 - in branches/gsoc_pdd09: include/parrot src/gc

Subject: [svn:parrot] r29894 - in branches/gsoc_pdd09: include/parrot src/gc
From: Whiteknight@xxxxxxxxxxxx
Date: Wed, 30 Jul 2008 17:55:56 -0700 (PDT)
Newsgroups: perl.cvs.parrot

Author: Whiteknight
Date: Wed Jul 30 17:55:55 2008
New Revision: 29894

Modified:
   branches/gsoc_pdd09/include/parrot/smallobject.h
   branches/gsoc_pdd09/src/gc/gc_it.c

Log:
[gsoc_pdd09] Some big changes:
* Remove the idea of "cards" entirely. It's expensive and complex, and the net 
benefits are nil
* Remove all datastructures and macros associated with the old cards
* Simplify arena allocator
* remove the ill-defined "config" member of the Gc_it_data structure, which has 
never found a use

Modified: branches/gsoc_pdd09/include/parrot/smallobject.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/smallobject.h    (original)
+++ branches/gsoc_pdd09/include/parrot/smallobject.h    Wed Jul 30 17:55:55 2008
@@ -29,17 +29,6 @@
     struct Small_Object_Arena *prev;
     struct Small_Object_Arena *next;
     void                      *start_objects;
-#if PARROT_GC_IT
-    unsigned char             *cards;
-    union {        /* store 2 16-bit values, force UINTVAL alignment */
-        struct {   /* These shouldn't get bigger then 65535, i don't think */
-            unsigned short int card_size;
-            unsigned short int last_index;
-        } _d;
-        UINTVAL                _align_x;
-    } card_info;
-    struct Small_Object_Pool *parent_pool;
-#endif
 } Small_Object_Arena;
 
 struct Small_Object_Pool;
@@ -119,8 +108,6 @@
 #    define GC_IT_THREAD_MAX 4
 #  endif
 
-#  define GC_IT_INITIAL_CONFIG 1 /* define this to be whatever */
-
 /* minimum number of items to scan in a single increment. If we haven't reached
    this minimum, go back and do another increment. */
 #  define GC_IT_ITEMS_MARKED_MIN  20
@@ -157,45 +144,11 @@
     } data;
 } Gc_it_hdr;
 
-/*
- * a basic structure to facilitate cardmarking. An array of these will 
represent
- * the card for a particular pool. Using uchar for the basic card element,
- * and assuming that a uchar is always 8bits or greater (we are simply ignoring
- * any additional bits)
- * The bitfield member will allow us to unwind the inner loop a little bit, and
- * avoid a lot of manual bitwise arithmetic
- */
-
-typedef unsigned char Gc_it_card;
-#  define GC_IT_CARD_MASK_1 0x03
-#  define GC_IT_CARD_MASK_2 0x0C
-#  define GC_IT_CARD_MASK_3 0x30
-#  define GC_IT_CARD_MASK_4 0xC0
-
-/* This definition is being padded to 4 bytes, which is wasteful when i am
-   only using 1 byte each.
-typedef union Gc_it_card {
-    unsigned char _c;
-    struct {
-        unsigned flag1:2;
-        unsigned flag2:2;
-        unsigned flag3:2;
-        unsigned flag4:2;
-    } _f;
-} Gc_it_card;
-*/
-
-#  define GC_IT_FLAGS_PER_CARD 4
 #  define GC_IT_CARD_WHITE  0x00     /* Item is dead */
 #  define GC_IT_CARD_UNUSED 0x01
 #  define GC_IT_CARD_BLACK  0x03     /* Item is completely alive */
 #  define GC_IT_CARD_FREE   0x02     /* items which are newly created and 
should
                                        not be scanned until the next mark */
-#  define GC_IT_CARD_ALL_MARK(f) ((f) | ((f) << 2) | ((f) << 4) | ((f) << 6))
-#  define GC_IT_CARD_ALL_WHITE  GC_IT_CARD_ALL_MARK(GC_IT_CARD_WHITE)
-#  define GC_IT_CARD_ALL_BLACK  GC_IT_CARD_ALL_MARK(GC_IT_CARD_BLACK)
-#  define GC_IT_CARD_ALL_UNUSED GC_IT_CARD_ALL_MARK(GC_IT_CARD_UNUSED)
-#  define GC_IT_CARD_ALL_FREE   GC_IT_CARD_ALL_MARK(GC_IT_CARD_FREE)
 
 #  define PObj_to_IT_HDR(o) (((Gc_it_hdr*)(o))-1)
 #  define IT_HDR_to_PObj(p) ((PObj*)(((Gc_it_hdr*)(p))+1))
@@ -217,13 +170,6 @@
     GC_IT_FINAL_CLEANUP  /* do any necessary cleanup after the GC run is over 
*/
 } Gc_it_state;
 
-/* Structure to contain configuration data about the GC, to determine
-   how it operates */
-
-typedef struct Gc_it_config {
-    UINTVAL num_to_mark;
-} Gc_it_config;
-
 /* A private datastructure for the GC. All the global data that we need to
    operate will be stored here. */
 
@@ -232,7 +178,6 @@
     UINTVAL total_count;      /* number of items scanned since beginning of 
mark phase */
     UINTVAL num_generations;  /* number of generations */
     Gc_it_state state;        /* status of the current run */
-    Gc_it_config config;      /* config data to tell how the GC operates */
     UINTVAL num_threads;      /* number of currently active threads */
     Gc_it_hdr *root_queue;    /* queue for temporary storage of root items */
     Gc_it_hdr *queue;         /* list of grey items, to mark */

Modified: branches/gsoc_pdd09/src/gc/gc_it.c
==============================================================================
--- branches/gsoc_pdd09/src/gc/gc_it.c  (original)
+++ branches/gsoc_pdd09/src/gc/gc_it.c  Wed Jul 30 17:55:55 2008
@@ -1120,53 +1120,17 @@
     const size_t real_size   = pool->object_size;
     const size_t num_objects = pool->objects_per_alloc;
 
-    /* The number of cards. I ASSUME that sizeof (Gc_it_card) == 1, but that
-       might not be the case. Therefore, this number must be multiplied by
-       sizeof (Gc_it_card) if it is going to be used as the physical size of
-       occupied memory. */
-    const size_t card_size = (num_objects / 4 + ((num_objects % 4) ? 1 : 0));
-    const size_t real_card_size = card_size * sizeof (Gc_it_card);
-
-    /* This is the actual size of the card in memory, plus any additional
-       space we need to allocate to force proper alignment of the rest of
-       the data objects.
-
-       At this point, all this arithmetic is just wishful thinking. Who knows
-       if it actually does what I keep saying it does? I'll have to test it or
-       something. */
-    const size_t align_offset = real_card_size % sizeof (void *);
-    const size_t card_size_align = real_card_size
-        + (align_offset ? (sizeof (void *) - align_offset) : 0);
-
     /* The size of the allocated arena. This is the size of the
        Small_Object_Arena structure, which goes at the front, the card, and
        the objects. */
     size_t size = (real_size * pool->objects_per_alloc) /* the objects */
-                + sizeof (Small_Object_Arena)           /* the arena   */
-                + card_size_align;                      /* the card    */
+                + sizeof (Small_Object_Arena);          /* the arena   */
     Small_Object_Arena * const new_arena =
         (Small_Object_Arena *)mem_internal_allocate(size);
-/*
-#  if GC_IT_DEBUG
-    fprintf(stderr, "Alloc objects for pool %s (%p)\n", pool->name, pool);
-#  endif
-*/
-    new_arena->card_info._d.card_size  = card_size;
-    new_arena->card_info._d.last_index = num_objects - 1;
-    new_arena->parent_pool             = pool;
-
-    /* ...the downside is this messy pointer arithmetic. The cards are packed
-       against the end of the Small_Object_Arena. The objects are packed at
-       the end of the cards. */
-    new_arena->cards = (Gc_it_card *)((char*)new_arena
-                     + sizeof (Small_Object_Arena));
+
     /* The objects are packed in after the cards (and any alignment space that
        we've added). */
-    new_arena->start_objects = (void *)((char *)new_arena->cards
-                             + card_size_align);
-    /* Clear all the cards. Set them to the value GC_IT_CARD_ALL_FREE for now,
-       indicating that all items are (or will be) on the free list to start. */
-    memset(new_arena->cards, GC_IT_CARD_ALL_FREE, real_card_size);
+    new_arena->start_objects = (void *)((char *)new_arena + sizeof 
(Small_Object_Arena));
 
     /* insert new_arena in pool's arena linked list */
     Parrot_append_arena_in_pool(interp, pool, new_arena,

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r29894 - in branches/gsoc_pdd09: include/parrot src/gc, Whiteknight <=