[pypy-commit] pypy stm: Re-enable cast_ptr_to_adr for now.

arigo noreply at buildbot.pypy.org
Fri Jan 20 10:03:06 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm
Changeset: r51509:f1643c0913ad
Date: 2012-01-19 23:02 +0100
http://bitbucket.org/pypy/pypy/changeset/f1643c0913ad/

Log:	Re-enable cast_ptr_to_adr for now.

diff --git a/pypy/translator/c/funcgen.py b/pypy/translator/c/funcgen.py
--- a/pypy/translator/c/funcgen.py
+++ b/pypy/translator/c/funcgen.py
@@ -686,9 +686,9 @@
 
     def OP_CAST_PTR_TO_ADR(self, op):
         if self.lltypemap(op.args[0]).TO._gckind == 'gc' and self._is_stm():
-            raise AssertionError("cast_ptr_to_adr(gcref) is a bad idea "
-                                 "with STM.  Consider checking config.stm "
-                                 "in %r" % (self.graph,))
+            from pypy.translator.c.support import log
+            log.WARNING("cast_ptr_to_adr(gcref) might be a bad idea with STM:")
+            log.WARNING("  %r" % (self.graph,))
         return self.OP_CAST_POINTER(op)
 
     def OP_CAST_INT_TO_PTR(self, op):
diff --git a/pypy/translator/stm/test/test_funcgen.py b/pypy/translator/stm/test/test_funcgen.py
--- a/pypy/translator/stm/test/test_funcgen.py
+++ b/pypy/translator/stm/test/test_funcgen.py
@@ -1,5 +1,6 @@
 from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.rlib.rarithmetic import r_longlong, r_singlefloat
+from pypy.rlib.objectmodel import compute_identity_hash
 from pypy.translator.stm.test.support import CompiledSTMTests
 from pypy.translator.stm._rffi_stm import (CALLBACK, stm_perform_transaction,
                                            stm_descriptor_init, stm_descriptor_done)
@@ -50,6 +51,16 @@
         _, data = cbuilder.cmdexec('', err=True)
         assert data.endswith('ok!\n')
 
+    def test_compile_identity_hash(self):
+        class A:
+            pass
+        def entry_point(argv):
+            a = A()
+            debug_print(compute_identity_hash(a))
+            return 0
+        t, cbuilder = self.compile(entry_point)
+        _, data = cbuilder.cmdexec('', err=True)
+
 # ____________________________________________________________
 
 A = lltype.GcStruct('A', ('x', lltype.Signed), ('y', lltype.Signed),


More information about the pypy-commit mailing list