[pypy-svn] r53480 - pypy/branch/jit-hotpath/pypy/jit/codegen/ia32

fijal at codespeak.net fijal at codespeak.net
Sun Apr 6 20:51:17 CEST 2008


Author: fijal
Date: Sun Apr  6 20:51:17 2008
New Revision: 53480

Modified:
   pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/objmodel.py
   pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/rgenop.py
Log:
Fix (a bit) test for write_frame_places. I still get some subtle
float errors (but I don't think I can ignore them)


Modified: pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/objmodel.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/objmodel.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/objmodel.py	Sun Apr  6 20:51:17 2008
@@ -85,10 +85,8 @@
         return builder.stack_access64(self.stackpos)
 
     def newvar(self, builder):
-        # XXX not tested and not sure if ever needed
-        raise NotImplementedError("write test first")
         ofs = (builder.stackdepth - self.stackpos - 1) * WORD
-        return builder.newfloatfrommem(esp, None, 0, ofs)
+        return builder.newfloatfrommem((esp, None, 0, ofs))
 
     def movetonewaddr(self, builder, addr):
         dstop1 = builder.mem_access(addr)

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	Sun Apr  6 20:51:17 2008
@@ -25,26 +25,28 @@
     # 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():
-        if T is lltype.Signed:
-            return addr.signed[0]
-        elif T is lltype.Float:
+        if T is lltype.Float:
             return addr.float[0]
         else:
-            raise NotImplementedError("Not implemented types " + str(T))
+            return addr.signed[0]
     else:
         tp = ctypes_mapping[T]
         p = cast(c_void_p(addr), POINTER(tp))
         return p[0]
 
-def poke_word_into(addr, value):
+ at specialize.arg(0)
+def poke_value_into(T, addr, value):
     # 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():
-        addr.signed[0] = value
+        if T is lltype.Float:
+            addr.float[0] = value
+        else:
+            addr.signed[0] = value
     else:
-        from ctypes import cast, c_void_p, c_int, POINTER
-        p = cast(c_void_p(addr), POINTER(c_int))
+        tp = ctypes_mapping[T]
+        p = cast(c_void_p(addr), POINTER(tp))
         p[0] = value
 
 def map_arg(arg):
@@ -402,19 +404,17 @@
         return self.returnintvar(eax)
         
     def genop_call(self, sigtoken, gv_fnptr, args_gv):
-        # WUAAA, this does not support floats
         numargs = len(sigtoken[0])
         MASK = CALL_ALIGN-1
         if MASK:
             final_depth = self.stackdepth + numargs
             delta = ((final_depth+MASK)&~MASK)-final_depth
             if delta:
-                xxx
                 self.mc.SUB(esp, imm(delta*WORD))
                 self.stackdepth += delta
         for i in range(numargs-1, -1, -1):
             gv_arg = args_gv[i]
-            self.push(gv_arg.operand(self))
+            gv_arg.newvar(self)
         if DEBUG_CALL_ALIGN:
             self.mc.MOV(eax, esp)
             self.mc.AND(eax, imm8((WORD*CALL_ALIGN)-1))
@@ -425,7 +425,10 @@
             self.mc.CALL(rel32(target))
         else:
             self.mc.CALL(gv_fnptr.operand(self))
-        # XXX only for int return_kind, check calling conventions
+        # XXX implement different calling conventions and different types
+        RESULT = sigtoken[1]
+        if RESULT == "f":
+            return self.returnfloatvar(st0)
         return self.returnintvar(eax)
 
     def genop_same_as(self, gv_x):
@@ -1351,8 +1354,7 @@
     @staticmethod
     @specialize.arg(0)
     def write_frame_place(T, base, place, value):
-        assert T is lltype.Signed
-        poke_word_into(base - place.stackpos * WORD, value)
+        poke_value_into(T, base - place.stackpos * WORD, value)
 
     @staticmethod
     @specialize.arg(0)



More information about the Pypy-commit mailing list