[pypy-svn] r60750 - in pypy/branch/oo-jit/pypy: jit/codegen/i386 jit/tl rpython/lltypesystem

arigo at codespeak.net arigo at codespeak.net
Thu Jan 1 18:02:54 CET 2009


Author: arigo
Date: Thu Jan  1 18:02:51 2009
New Revision: 60750

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/i386/ri386.py
   pypy/branch/oo-jit/pypy/jit/tl/tlc.py
   pypy/branch/oo-jit/pypy/rpython/lltypesystem/lltype.py
Log:
* simplify the code in tlc for green values.

* add 'heap8' to ri386 -- sorry, forgot about it previously.

* implement _cast_to_int() on lltype pointers to do the real
  thing instead of returning a randomish number.



Modified: pypy/branch/oo-jit/pypy/jit/codegen/i386/ri386.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/i386/ri386.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/i386/ri386.py	Thu Jan  1 18:02:51 2009
@@ -259,6 +259,9 @@
 def heap(offset):
     return memSIB(None, None, 0, offset)
 
+def heap8(offset):
+    return memSIB8(None, None, 0, offset)
+
 def heap64(offset):
     return memSIB64(None, None, 0, offset)
 

Modified: pypy/branch/oo-jit/pypy/jit/tl/tlc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/tl/tlc.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/tl/tlc.py	Thu Jan  1 18:02:51 2009
@@ -461,8 +461,10 @@
                 num_args += 1 # include self
                 name = pool.strings[idx]
                 meth_args = [None] * num_args
-                for i in range(num_args):
-                    meth_args[-i-1] = stack.pop()
+                while num_args > 0:
+                    num_args -= 1
+                    meth_args[num_args] = stack.pop()
+                    hint(num_args, concrete=True)
                 a = meth_args[0]
                 hint(a, promote_class=True)
                 meth_pc = hint(a.send(name), promote=True)

Modified: pypy/branch/oo-jit/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/lltypesystem/lltype.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/lltypesystem/lltype.py	Thu Jan  1 18:02:51 2009
@@ -1171,12 +1171,14 @@
         obj = self._obj
         if isinstance(obj, int):
             return obj     # special case for cast_int_to_ptr() results
-        obj = normalizeptr(self)._obj
-        result = intmask(obj._getid())
-        # assume that id() returns an addressish value which is
-        # not zero and aligned to at least a multiple of 4
-        assert result != 0 and (result & 3) == 0
-        return result
+        # use ll2ctypes to obtain a real ctypes-based representation of
+        # the memory, and cast that address as an integer
+        import ctypes
+        from pypy.rpython.lltypesystem import ll2ctypes
+        c = ll2ctypes.lltype2ctypes(self)
+        c = ctypes.cast(c, ctypes.c_void_p)
+        assert c.value
+        return c.value
 
     def _cast_to_adr(self):
         from pypy.rpython.lltypesystem import llmemory



More information about the Pypy-commit mailing list