Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r929:d6bde44bb839
Date: 2014-03-02 20:20 +0100
http://bitbucket.org/pypy/stmgc/changeset/d6bde44bb839/

Log:    Ah, I knew there was a bug.

diff --git a/c7/stm/prebuilt.c b/c7/stm/prebuilt.c
--- a/c7/stm/prebuilt.c
+++ b/c7/stm/prebuilt.c
@@ -35,6 +35,10 @@
     char *realnobj = REAL_ADDRESS(stm_object_pages, nobj);
     memcpy(realnobj, (char *)objaddr, size);
 
+    /* Fix the flags in the copied object, asserting that it was zero so far */
+    assert(nobj->stm_flags == 0);
+    nobj->stm_flags = GCFLAG_WRITE_BARRIER;
+
     /* Mark the original object */
     pforwarded_array[0] = GCWORD_PREBUILT_MOVED;
     pforwarded_array[1] = nobj;
diff --git a/c7/test/test_prebuilt.py b/c7/test/test_prebuilt.py
--- a/c7/test/test_prebuilt.py
+++ b/c7/test/test_prebuilt.py
@@ -61,6 +61,8 @@
         print lp2
         assert lp2 != lp1
         assert stm_get_ref(lp2, 0) == lp1
+        assert lib._stm_get_flags(lp1) == lib._STM_GCFLAG_WRITE_BARRIER
+        assert lib._stm_get_flags(lp2) == lib._STM_GCFLAG_WRITE_BARRIER
 
     def test_multiple_calls_to_stm_setup_prebuilt_1(self, reverse=False):
         static1 = prebuilt_refs(1)
@@ -76,6 +78,8 @@
         self.start_transaction()
         assert stm_get_ref(lp1, 0) == lp2
         assert stm_get_ref(lp2, 0) == ffi.NULL
+        assert lib._stm_get_flags(lp1) == lib._STM_GCFLAG_WRITE_BARRIER
+        assert lib._stm_get_flags(lp2) == lib._STM_GCFLAG_WRITE_BARRIER
 
     def test_multiple_calls_to_stm_setup_prebuilt_2(self):
         self.test_multiple_calls_to_stm_setup_prebuilt_1(reverse=True)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to