Author: Remi Meier <remi.me...@inf.ethz.ch>
Branch: c8-faster-smallobj-sync
Changeset: r1932:bd7979af1bf7
Date: 2015-08-11 14:38 +0200
http://bitbucket.org/pypy/stmgc/changeset/bd7979af1bf7/

Log:    implement major collection fixup; tests pass

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -1835,6 +1835,5 @@
 
     /* no merge was found */
     STM_PSEGMENT->small_overflow_obj_ranges =
-        list_append2(STM_PSEGMENT->small_overflow_obj_ranges,
-                     (uintptr_t)obj, (uintptr_t)obj_size);
+        list_append2(lst, (uintptr_t)obj, (uintptr_t)obj_size);
 }
diff --git a/c8/stm/gcpage.c b/c8/stm/gcpage.c
--- a/c8/stm/gcpage.c
+++ b/c8/stm/gcpage.c
@@ -597,8 +597,44 @@
             }
         }
 
-        /* XXX: fix small_overflow_obj_ranges */
-        abort();
+        /* fix ranges in small_overflow_obj_ranges that may have
+           holes from dying objs */
+        lst = pseg->small_overflow_obj_ranges;
+        if (!list_is_empty(lst)) {
+            long j;
+            struct list_s *new_lst = list_create();
+            for (j = lst->count - 2; j >= 0; j -= 2) {
+                stm_char *start = (stm_char*)lst->items[j];
+                ssize_t size = (ssize_t)lst->items[j+1];
+
+                struct object_s *realobj = (struct object_s *)
+                    REAL_ADDRESS(pseg->pub.segment_base, start);
+                size_t obj_size = stmcb_size_rounded_up(realobj);
+                assert(size % obj_size == 0);
+
+                stm_char *obj = start, *range_end = start + size;
+                for (; obj < range_end; obj += obj_size) {
+                    /* note: all these obj-slots *are* in use by overflow objs 
*/
+                    if (!mark_visited_test((object_t*)obj)) {
+                        if (obj != start) {
+                            new_lst = list_append2(new_lst,
+                                                   (uintptr_t)start,
+                                                   (uintptr_t)(obj - start));
+                        }
+                        start = obj + obj_size; // next start
+                    }
+                }
+                if (obj != start) {
+                    new_lst = list_append2(new_lst,
+                                           (uintptr_t)start,
+                                           (uintptr_t)(obj - start));
+                }
+            }
+
+            list_free(lst);
+            pseg->small_overflow_obj_ranges = new_lst;
+        }
+
 
         /* Remove from 'modified_old_objects' all old hashtables that die */
         {
diff --git a/c8/stm/smallmalloc.h b/c8/stm/smallmalloc.h
--- a/c8/stm/smallmalloc.h
+++ b/c8/stm/smallmalloc.h
@@ -49,22 +49,6 @@
 */
 struct small_malloc_data_s {
     struct small_free_loc_s *loc_free[GC_N_SMALL_REQUESTS];
-
-    /* with "uncommitted_ranges", we do the following during major GCs:
-
-       for seg in segments:
-           for r in seg.uncommitted_ranges:
-               size = obj_size_in_seg(seg, (object_t*)r)
-               assert(r.size % size == 0)
-               for(obj = r; obj < r + r.size; r += size):
-                   if obj_dies(obj):
-                       adjust_range(r) // split/shrink
-
-       Optionally, we can also merge ranges, sort the list, etc.
-       But generally, I hope we don't have too many uncommitted
-       ranges; and I don't know, if there is another way to get
-       the size(-class) of the page/objs.
-     */
 };
 
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to