[pypy-svn] r53286 - in pypy/branch/jit-hotpath/pypy/jit/codegen/ia32: . test

fijal at codespeak.net fijal at codespeak.net
Thu Apr 3 20:17:02 CEST 2008


Author: fijal
Date: Thu Apr  3 20:17:01 2008
New Revision: 53286

Modified:
   pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/rgenop.py
   pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/test/test_rgenop.py
Log:
frame access for ints (for floats and bools it needs to be adapted, but
we have no tests for that)


Modified: pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/rgenop.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/rgenop.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/rgenop.py	Thu Apr  3 20:17:01 2008
@@ -9,7 +9,6 @@
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rpython.annlowlevel import llhelper
 from pypy.rpython.lltypesystem import rffi
-from pypy.jit.codegen.emit_moves import emit_moves, emit_moves_safe
 
 WORD = 4
 DEBUG_CALL_ALIGN = True
@@ -18,6 +17,17 @@
 else:
     CALL_ALIGN = 1
 
+def peek_word_at(addr):
+    # now the Very Obscure Bit: when translated, 'addr' is an
+    # address.  When not, it's an integer.  It just happens to
+    # make the test pass, but that's probably going to change.
+    if objectmodel.we_are_translated():
+        return addr.signed[0]
+    else:
+        from ctypes import cast, c_void_p, c_int, POINTER
+        p = cast(c_void_p(addr), POINTER(c_int))
+        return p[0]
+
 class Var(GenVar):
 
     def __init__(self, stackpos):
@@ -465,6 +475,15 @@
             op = eax
         return self.returnintvar(op)
 
+    def genop_get_frame_base(self):
+        # XXX really?
+        self.mc.MOV(eax, esp)
+        self.mc.SUB(eax, imm(self.stackdepth))
+        return self.returnintvar(eax)
+
+    def get_frame_info(self, vars_gv):
+        return vars_gv
+
     def genop_setfield(self, (offset, fieldsize), gv_ptr, gv_value):
         self.mc.MOV(eax, gv_value.operand(self))
         self.mc.MOV(edx, gv_ptr.operand(self))
@@ -1430,6 +1449,18 @@
         # XXX kind probably goes away
         return zero_const
 
+    @staticmethod
+    @specialize.arg(0)
+    def read_frame_var(T, base, info, index):
+        assert T is lltype.Signed
+        v = info[index]
+        value = peek_word_at(base + v.stackpos + 1)
+        return value
+
+    @staticmethod
+    def genconst_from_frame_var(kind, base, info, index):
+        xxx
+
 global_rgenop = RI386GenOp()
 RI386GenOp.constPrebuiltGlobal = global_rgenop.genconst
 zero_const = AddrConst(llmemory.NULL)

Modified: pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/test/test_rgenop.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/test/test_rgenop.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/test/test_rgenop.py	Thu Apr  3 20:17:01 2008
@@ -14,7 +14,6 @@
         py.test.skip("unsupported")
 
     # frame access related
-    test_read_frame_var_direct = skipped
     test_genconst_from_frame_var_direct = skipped
     test_write_frame_place_direct = skipped
     test_write_lots_of_frame_places_direct = skipped


More information about the pypy-svn mailing list