[pypy-svn] r67440 - in pypy/trunk/pypy/jit/backend: llgraph test

arigo at codespeak.net arigo at codespeak.net
Thu Sep 3 11:50:26 CEST 2009


Author: arigo
Date: Thu Sep  3 11:50:26 2009
New Revision: 67440

Modified:
   pypy/trunk/pypy/jit/backend/llgraph/runner.py
   pypy/trunk/pypy/jit/backend/test/runner_test.py
Log:
Oups.  Fix runner_test: we no longer have CAST_INT_TO_PTR.


Modified: pypy/trunk/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/llgraph/runner.py	(original)
+++ pypy/trunk/pypy/jit/backend/llgraph/runner.py	Thu Sep  3 11:50:26 2009
@@ -228,6 +228,9 @@
     def cast_int_to_adr(self, int):
         return llimpl.cast_int_to_adr(self.memo_cast, int)
 
+    def cast_gcref_to_int(self, gcref):
+        return self.cast_adr_to_int(llmemory.cast_ptr_to_adr(gcref))
+
 
 
 class LLtypeCPU(BaseCPU):

Modified: pypy/trunk/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/test/runner_test.py	(original)
+++ pypy/trunk/pypy/jit/backend/test/runner_test.py	Thu Sep  3 11:50:26 2009
@@ -620,14 +620,10 @@
         x = lltype.cast_opaque_ptr(llmemory.GCREF, x)
         res = self.execute_operation(rop.CAST_PTR_TO_INT,
                                      [BoxPtr(x)],  'int').value
-        res2 = self.execute_operation(rop.CAST_INT_TO_PTR,
-                                      [BoxInt(res)], 'ref').value
-        x = lltype.cast_opaque_ptr(llmemory.GCREF, x)
+        assert res == self.cpu.cast_gcref_to_int(x)
         res = self.execute_operation(rop.CAST_PTR_TO_INT,
                                      [ConstPtr(x)],  'int').value
-        res2 = self.execute_operation(rop.CAST_INT_TO_PTR,
-                                      [ConstInt(res)], 'ref').value
-        assert res2 == x
+        assert res == self.cpu.cast_gcref_to_int(x)
 
     def test_ooops_non_gc(self):
         x = lltype.malloc(lltype.Struct('x'), flavor='raw')
@@ -851,9 +847,7 @@
         x = cpu.do_newstr([BoxInt(5)])
         y = cpu.do_cast_ptr_to_int([x])
         assert isinstance(y, BoxInt)
-        z = cpu.do_cast_int_to_ptr([y])
-        assert isinstance(z, BoxPtr)
-        assert z.value == x.value
+        assert y.value == cpu.cast_gcref_to_int(x.value)
 
     def test_sorting_of_fields(self):
         S = self.S



More information about the Pypy-commit mailing list