Author: Remi Meier
Branch: c7
Changeset: r657:a9bedcca21e2
Date: 2014-01-21 10:49 +0100
http://bitbucket.org/pypy/stmgc/changeset/a9bedcca21e2/

Log:    fix privatization of pages in write-barrier slowpath

diff --git a/c7/core.c b/c7/core.c
--- a/c7/core.c
+++ b/c7/core.c
@@ -366,7 +366,10 @@
     }
 
     /* privatize if SHARED_PAGE */
-    _stm_privatize(pagenum);
+    /* xxx stmcb_size() is probably too slow */
+    int pages = stmcb_size(real_address(obj)) / 4096;
+    for (; pages >= 0; pages--)
+        _stm_privatize(pagenum + pages);
 
     /* claim the write-lock for this object */
     uintptr_t lock_idx = (((uintptr_t)obj) >> 4) - READMARKER_START;
@@ -433,7 +436,7 @@
         int pages = (size + 4095) / 4096;
         int i;
         for (i = 0; i < pages; i++) {
-            flag_page_private[page + i] = UNCOMMITTED_SHARED_PAGE;
+            mark_page_as_uncommitted(page + i);
         }
     } else { 
         alloc_for_size_t *alloc = &_STM_TL2->alloc[size_class];
diff --git a/c7/test/test_basic.py b/c7/test/test_basic.py
--- a/c7/test/test_basic.py
+++ b/c7/test/test_basic.py
@@ -373,8 +373,14 @@
         stm_stop_transaction()
         new = stm_pop_root()
 
+        assert ([stm_get_page_flag(p) for p in stm_get_obj_pages(new)]
+                == [lib.SHARED_PAGE]*2)
+
         stm_start_transaction()
         stm_write(new)
+        assert ([stm_get_page_flag(p) for p in stm_get_obj_pages(new)]
+                == [lib.PRIVATE_PAGE]*2)
+        
         # write to 2nd page of object!!
         wnew = stm_get_real_address(new)
         wnew[4097] = 'x'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to