[pypy-commit] stmgc c8-new-page-handling: fix wrong nesting

Raemi noreply at buildbot.pypy.org
Fri Sep 19 13:09:31 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: c8-new-page-handling
Changeset: r1396:6960f1340af8
Date: 2014-09-19 13:06 +0200
http://bitbucket.org/pypy/stmgc/changeset/6960f1340af8/

Log:	fix wrong nesting

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -366,6 +366,8 @@
     for (page = first_page; page <= end_page; page++) {
         /* check if our page is private or we are the only shared-page holder */
         assert(get_page_status_in(my_segnum, page) != PAGE_NO_ACCESS);
+        /* XXX: actually, it can be NO_ACCESS if somebody changed that after we
+           copied from it */
 
         if (get_page_status_in(my_segnum, page) == PAGE_PRIVATE)
             continue;
diff --git a/c8/stm/pages.c b/c8/stm/pages.c
--- a/c8/stm/pages.c
+++ b/c8/stm/pages.c
@@ -39,11 +39,12 @@
             char *segment_base = get_segment_base(i);
             mprotect(segment_base + pagenum * 4096UL,
                      count * 4096UL, PROT_NONE);
+
+            long amount = count;
+            while (amount-->0) {
+                set_page_status_in(i, pagenum + amount, PAGE_NO_ACCESS);
+            }
         }
-
-        long amount = count;
-        while (amount-->0)
-            set_page_status_in(i, pagenum + amount, PAGE_NO_ACCESS);
     }
 }
 
diff --git a/c8/stm/pages.h b/c8/stm/pages.h
--- a/c8/stm/pages.h
+++ b/c8/stm/pages.h
@@ -39,8 +39,8 @@
 
 enum {
     PAGE_SHARED = 0,
-    PAGE_PRIVATE,
-    PAGE_NO_ACCESS,
+    PAGE_PRIVATE = 1,
+    PAGE_NO_ACCESS = 2,
 };
 
 static struct page_shared_s pages_status[NB_SHARED_PAGES];


More information about the pypy-commit mailing list