[pypy-commit] stmgc c7-more-segments: Kill unused stuff

arigo noreply at buildbot.pypy.org
Sat Mar 15 17:28:11 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-more-segments
Changeset: r1019:1eef635359f7
Date: 2014-03-15 17:01 +0100
http://bitbucket.org/pypy/stmgc/changeset/1eef635359f7/

Log:	Kill unused stuff

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -59,7 +59,7 @@
            the common case. Otherwise, we need to compute it based on
            its location and size. */
         if ((obj->stm_flags & GCFLAG_SMALL_UNIFORM) != 0) {
-            pages_privatize(first_page, 1, true);
+            pages_privatize(first_page, 1);
         }
         else {
             char *realobj;
@@ -73,7 +73,7 @@
             /* that's the page *following* the last page with the object */
             end_page = (((uintptr_t)obj) + obj_size + 4095) / 4096UL;
 
-            pages_privatize(first_page, end_page - first_page, true);
+            pages_privatize(first_page, end_page - first_page);
         }
     }
     else if (write_locks[lock_idx] == lock_num) {
diff --git a/c7/stm/pages.c b/c7/stm/pages.c
--- a/c7/stm/pages.c
+++ b/c7/stm/pages.c
@@ -133,7 +133,7 @@
 }
 #endif
 
-static void privatize_range(uintptr_t pagenum, uintptr_t count, bool full)
+static void privatize_range(uintptr_t pagenum, uintptr_t count)
 {
     ssize_t pgoff1 = pagenum;
     ssize_t pgoff2 = pagenum + NB_PAGES;
@@ -146,29 +146,16 @@
     memset(flag_page_private + pagenum, REMAPPING_PAGE, count);
     d_remap_file_pages(localpg, count * 4096, pgoff2);
     uintptr_t i;
-    if (full) {
-        for (i = 0; i < count; i++) {
-            pagecopy(localpg + 4096 * i, otherpg + 4096 * i);
-        }
-    }
-    else {
-        pagecopy(localpg, otherpg);
-        if (count > 1)
-            pagecopy(localpg + 4096 * (count-1), otherpg + 4096 * (count-1));
+    for (i = 0; i < count; i++) {
+        pagecopy(localpg + 4096 * i, otherpg + 4096 * i);
     }
     write_fence();
     memset(flag_page_private + pagenum, PRIVATE_PAGE, count);
     increment_total_allocated(4096 * count);
 }
 
-static void _pages_privatize(uintptr_t pagenum, uintptr_t count, bool full)
+static void _pages_privatize(uintptr_t pagenum, uintptr_t count)
 {
-    /* narrow the range of pages to privatize from the end: */
-    while (flag_page_private[pagenum + count - 1] == PRIVATE_PAGE) {
-        if (!--count)
-            return;
-    }
-
     mutex_pages_lock();
 
     uintptr_t page_start_range = pagenum;
@@ -179,7 +166,7 @@
         if (prev == PRIVATE_PAGE) {
             if (pagenum > page_start_range) {
                 privatize_range(page_start_range,
-                                pagenum - page_start_range, full);
+                                pagenum - page_start_range);
             }
             page_start_range = pagenum + 1;
         }
@@ -190,7 +177,7 @@
 
     if (pagenum > page_start_range) {
         privatize_range(page_start_range,
-                        pagenum - page_start_range, full);
+                        pagenum - page_start_range);
     }
 
     mutex_pages_unlock();
diff --git a/c7/stm/pages.h b/c7/stm/pages.h
--- a/c7/stm/pages.h
+++ b/c7/stm/pages.h
@@ -21,9 +21,8 @@
 
 static uint8_t flag_page_private[NB_PAGES];
 
-static void _pages_privatize(uintptr_t pagenum, uintptr_t count, bool full);
+static void _pages_privatize(uintptr_t pagenum, uintptr_t count);
 static void pages_initialize_shared(uintptr_t pagenum, uintptr_t count);
-//static void pages_make_shared_again(uintptr_t pagenum, uintptr_t count);
 
 static void mutex_pages_lock(void);
 static void mutex_pages_unlock(void);
@@ -32,8 +31,7 @@
 static void force_major_collection_request(void);
 static void reset_major_collection_requested(void);
 
-inline static void pages_privatize(uintptr_t pagenum, uintptr_t count,
-                                   bool full) {
+inline static void pages_privatize(uintptr_t pagenum, uintptr_t count) {
     /* This is written a bit carefully so that a call with a constant
        count == 1 will turn this loop into just one "if". */
     while (flag_page_private[pagenum] == PRIVATE_PAGE) {
@@ -42,7 +40,5 @@
         }
         pagenum++;
     }
-    _pages_privatize(pagenum, count, full);
+    _pages_privatize(pagenum, count);
 }
-
-/* static bool is_fully_in_shared_pages(object_t *obj); */


More information about the pypy-commit mailing list