[pypy-commit] stmgc c8-new-page-handling: test and fix

Raemi noreply at buildbot.pypy.org
Wed Sep 24 15:26:23 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: c8-new-page-handling
Changeset: r1423:8748c8466dde
Date: 2014-09-24 15:26 +0200
http://bitbucket.org/pypy/stmgc/changeset/8748c8466dde/

Log:	test and fix

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -74,9 +74,8 @@
         struct stm_undo_s *end = from->written + from->written_count;
 
         import_objects(from->segment_num, pagenum, undo, end);
+        copy_bk_objs_in_page_from(from->segment_num, pagenum);
     }
-
-    copy_bk_objs_in_page_from(to->segment_num, pagenum);
 }
 
 static void go_to_the_past(uintptr_t pagenum,
diff --git a/c8/test/test_basic.py b/c8/test/test_basic.py
--- a/c8/test/test_basic.py
+++ b/c8/test/test_basic.py
@@ -252,6 +252,41 @@
         py.test.raises(Conflict, self.commit_transaction)
         assert res == 'a'
 
+    def test_read_write_15(self):
+        lp1 = stm_allocate_old(16) # allocated in seg0
+        lp2 = stm_allocate_old(16) # allocated in seg0
+        stm_get_real_address(lp1)[HDR] = 'a' #setchar
+        stm_get_real_address(lp2)[HDR] = 'b' #setchar
+        # S|P|P|P|P
+        #
+        # NO_ACCESS in all segments except seg0 (shared page holder)
+        #
+        # all seg at R0
+        #
+        self.start_transaction()
+        #
+        self.switch(1) # with private page
+        self.start_transaction()
+        stm_set_char(lp2, 'C')
+        self.commit_transaction() # R1
+        assert last_commit_log_entries() == [lp2] # commit 'C'
+        self.start_transaction()
+        stm_set_char(lp2, 'c') # R1.1
+        #
+        self.switch(2)
+        self.start_transaction()
+        stm_set_char(lp1, 'D')
+        self.commit_transaction()  # R2
+        assert last_commit_log_entries() == [lp1] # commit 'D'
+        self.start_transaction()
+        stm_set_char(lp1, 'd') # R2.1
+        #
+        self.switch(3)
+        self.start_transaction() # stm_validate() -> R2
+        assert stm_get_char(lp1) == 'D'
+        assert stm_get_char(lp2) == 'C'
+        self.commit_transaction()
+        #
 
 
     def test_commit_fresh_objects(self):


More information about the pypy-commit mailing list