[pypy-svn] r35937 - in pypy/dist/pypy/translator/llvm: . test

mwh at codespeak.net mwh at codespeak.net
Thu Dec 21 16:45:04 CET 2006


Author: mwh
Date: Thu Dec 21 16:45:02 2006
New Revision: 35937

Modified:
   pypy/dist/pypy/translator/llvm/database.py
   pypy/dist/pypy/translator/llvm/test/test_rtagged.py
Log:
so i finally figured out enough llvm syntax to get test_rtagged.py to pass.
not sure about translate.py --objspace-std-withtaggedints yet.


Modified: pypy/dist/pypy/translator/llvm/database.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/database.py	(original)
+++ pypy/dist/pypy/translator/llvm/database.py	Thu Dec 21 16:45:02 2006
@@ -150,6 +150,9 @@
                 if value.ob is not None:
                     self.prepare_constant(lltype.typeOf(value.ob), value.ob)
             return
+
+        if isinstance(type_, lltype.Ptr) and isinstance(value._obj, int):
+            return
         
         if isinstance(type_, lltype.Ptr):
             type_ = type_.TO
@@ -193,6 +196,9 @@
                 
             value = ptrvalue._obj
 
+            if isinstance(value, int):
+                return
+
             # Only prepare root values at this point 
             if isinstance(ct, lltype.Array) or isinstance(ct, lltype.Struct):
                 p, c = lltype.parentlink(value)
@@ -234,7 +240,11 @@
                 return self.primitives.repr(arg.concretetype, arg.value)
             else:
                 assert isinstance(arg.value, lltype._ptr)
-                if not arg.value:
+                if isinstance(arg.value._obj, int):
+                    rt = self.repr_type(arg.concretetype)
+                    v = repr(arg.value._obj)
+                    return 'cast (int %s to %s)'%(v, rt)
+                elif not arg.value:
                     return 'null'
                 else:
                     node = self.obj2node[arg.value._obj]
@@ -283,6 +293,9 @@
             if value is None:
                 return None, "%s null" % toptr
 
+            if isinstance(value, int):
+                return None, 'cast (int %s to %s)'%(value, toptr)
+
             node = self.obj2node[value]
             ref = node.get_pbcref(toptr)
             return node, "%s %s" % (toptr, ref)

Modified: pypy/dist/pypy/translator/llvm/test/test_rtagged.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_rtagged.py	(original)
+++ pypy/dist/pypy/translator/llvm/test/test_rtagged.py	Thu Dec 21 16:45:02 2006
@@ -1,10 +1,6 @@
 import sys, os
 from pypy.rlib.objectmodel import UnboxedValue
 
-import py
-
-py.test.skip("not working at present")
-
 class A(object):
     __slots__ = ()
     def meth(self, x):



More information about the Pypy-commit mailing list