Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r70184:b76622eef525
Date: 2014-03-23 08:51 +0100
http://bitbucket.org/pypy/pypy/changeset/b76622eef525/

Log:    Test and fix

diff --git a/rpython/memory/gctransform/framework.py 
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -727,7 +727,7 @@
         self.pop_roots(hop, livevars)
 
     def gct_gc_can_move(self, hop):
-        assert not self.translator.config.translation.stm, "XXX"
+        assert not self.translator.config.translation.stm
         op = hop.spaceop
         v_addr = hop.genop('cast_ptr_to_adr',
                            [op.args[0]], resulttype=llmemory.Address)
@@ -738,7 +738,7 @@
         if self.shrink_array_ptr is None:
             return GCTransformer.gct_shrink_array(self, hop)
         op = hop.spaceop
-        assert not self.translator.config.translation.stm, "XXX"
+        assert not self.translator.config.translation.stm
         v_addr = hop.genop('cast_ptr_to_adr',
                            [op.args[0]], resulttype=llmemory.Address)
         v_length = op.args[1]
@@ -795,7 +795,7 @@
         ofs = llmemory.offsetof(self.c_const_gcdata.concretetype.TO,
                                 'inst_' + attrname)
         c_ofs = rmodel.inputconst(lltype.Signed, ofs)
-        assert not self.translator.config.translation.stm, "XXX"
+        assert not self.translator.config.translation.stm
         v_gcdata_adr = hop.genop('cast_ptr_to_adr', [self.c_const_gcdata],
                                  resulttype=llmemory.Address)
         hop.genop('adr_add', [v_gcdata_adr, c_ofs], resultvar=op.result)
diff --git a/rpython/memory/gctransform/stmframework.py 
b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -110,6 +110,9 @@
             lltype.Signed, rstm.adr_write_slowpath)
         hop.genop("cast_int_to_ptr", [c_write_slowpath], resultvar=op.result)
 
+    def gct_gc_can_move(self, hop):
+        hop.rename('stm_can_move')
+
 ##    def _gct_with_roots_pushed(self, hop):
 ##        livevars = self.push_roots(hop)
 ##        self.default(hop)
diff --git a/rpython/translator/stm/funcgen.py 
b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -64,7 +64,7 @@
 def stm_can_move(funcgen, op):
     arg0 = funcgen.expr(op.args[0])
     result = funcgen.expr(op.result)
-    return '%s = stm_can_move(%s);' % (result, arg0)
+    return '%s = stm_can_move((object_t *)%s);' % (result, arg0)
 
 def stm_allocate_tid(funcgen, op):
     arg_size    = funcgen.expr(op.args[0])
diff --git a/rpython/translator/stm/test/test_ztranslated.py 
b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -382,7 +382,7 @@
         assert match
         assert int(match.group(1)) < 20
 
-    def test_gc_writebarrier(self):
+    def test_gc_writebarrier_and_misc(self):
         X = lltype.GcStruct('X', ('foo', lltype.Signed))
         prebuilt = lltype.malloc(X, immortal=True)
         prebuilt.foo = 42
@@ -393,6 +393,7 @@
             prebuilt.foo = 43
             debug_print(objectmodel.current_object_addr_as_int(prebuilt))
             llop.get_write_barrier_failing_case(rffi.VOIDP)
+            assert llop.gc_can_move(lltype.Bool, prebuilt) == False
             return 0
 
         t, cbuilder = self.compile(main)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to