Author: Whiteknight
Date: Sun Jul 27 17:20:09 2008
New Revision: 29811

Modified:
   branches/gsoc_pdd09/src/gc/gc_it.c
   branches/gsoc_pdd09/src/gc/smallobject.c

Log:
[gsoc_pdd09] few changes
* Better maintenance of pool->num_free_objects in my allocators/deallocators
* remove some unused cruft from smallobjects.c
* Maybe some other stuff I don't remember

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  Sun Jul 27 17:20:09 2008
@@ -591,6 +591,7 @@
                 GC_IT_ADD_TO_FREE_LIST(pool, hdr);
                 Parrot_dod_free_pmc(interp, pool, IT_HDR_to_PObj(hdr));
                 gc_it_set_card_mark(hdr, GC_IT_CARD_FREE);
+                ++pool->num_free_objects;
             }
             else if (mark == GC_IT_CARD_BLACK) {
                 gc_it_set_card_mark(hdr, GC_IT_CARD_WHITE);
@@ -646,6 +647,7 @@
                     if (mark == GC_IT_CARD_WHITE) {
                         GC_IT_ADD_TO_FREE_LIST(pool, hdr);
                         gc_it_set_card_mark_index(card, 3, GC_IT_CARD_FREE);
+                        ++pool->num_free_objects;
                     }
                     else if (mark == GC_IT_CARD_BLACK)
                         gc_it_set_card_mark_index(card, 3, GC_IT_CARD_WHITE);
@@ -656,6 +658,7 @@
                     if (mark == GC_IT_CARD_WHITE) {
                         GC_IT_ADD_TO_FREE_LIST(pool, hdr);
                         gc_it_set_card_mark_index(card, 2, GC_IT_CARD_FREE);
+                        ++pool->num_free_objects;
                     }
                     else if (mark == GC_IT_CARD_BLACK)
                         gc_it_set_card_mark_index(card, 2, GC_IT_CARD_WHITE);
@@ -666,6 +669,7 @@
                     if (mark == GC_IT_CARD_WHITE) {
                         GC_IT_ADD_TO_FREE_LIST(pool, hdr);
                         gc_it_set_card_mark_index(card, 1, GC_IT_CARD_FREE);
+                        ++pool->num_free_objects;
                     }
                     else if (mark == GC_IT_CARD_BLACK)
                         gc_it_set_card_mark_index(card, 1, GC_IT_CARD_WHITE);
@@ -677,6 +681,7 @@
                     if (mark == GC_IT_CARD_WHITE) {
                         GC_IT_ADD_TO_FREE_LIST(pool, hdr);
                         gc_it_set_card_mark_index(card, 0, GC_IT_CARD_FREE);
+                        ++pool->num_free_objects;
                     }
                     else if (mark == GC_IT_CARD_BLACK)
                         gc_it_set_card_mark_index(card, 0, GC_IT_CARD_WHITE);
@@ -771,7 +776,6 @@
 }
 #  endif
 
-
 #  if GC_IT_INCREMENT_MODE
 /*
 
@@ -980,6 +984,7 @@
        here and don't free the object manually. */
     if (hdr->next)
         return;
+    ++pool->num_free_objects;
 
     hdr->next       = (Gc_it_hdr *)pool->free_list;
     pool->free_list = hdr;
@@ -1163,6 +1168,8 @@
     /* allocate more next time */
     pool->objects_per_alloc =
         (UINTVAL)pool->objects_per_alloc * UNITS_PER_ALLOC_GROWTH_FACTOR;
+    pool->replenish_level   =
+        (size_t)(pool->total_objects * REPLENISH_LEVEL_FACTOR);
 
     size = real_size * pool->objects_per_alloc;
 

Modified: branches/gsoc_pdd09/src/gc/smallobject.c
==============================================================================
--- branches/gsoc_pdd09/src/gc/smallobject.c    (original)
+++ branches/gsoc_pdd09/src/gc/smallobject.c    Sun Jul 27 17:20:09 2008
@@ -90,21 +90,6 @@
 INTVAL
 contained_in_pool(ARGIN(const Small_Object_Pool *pool), ARGIN(const void *ptr))
 {
-#if 0
-#  if PARROT_GC_IT
-    /* This should be robust enough. However, I think there is a small
-       chance that the incoming pointer might magically be near a pointer
-       that points to a valid arena, which in turn will point to the
-       particular pool. This is unlikely, I think. */
-    const Gc_it_hdr * const hdr = cPObj_to_IT_HDR(ptr);
-    if (hdr->parent_arena && hdr->parent_arena->parent_pool &&
-       hdr->parent_arena->parent_pool == pool)
-        return 1;
-    return 0;
-#  else
-
-#  endif
-#endif
     const Small_Object_Arena *arena;
 
     ptr = (const void *)PObj_to_ARENA(ptr);
@@ -120,7 +105,6 @@
     }
 
     return 0;
-/*#endif*/
 }
 
 /*

Reply via email to