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

fijal at codespeak.net fijal at codespeak.net
Thu Apr 3 21:45:49 CEST 2008


Author: fijal
Date: Thu Apr  3 21:45:49 2008
New Revision: 53292

Modified:
   pypy/branch/jit-hotpath/pypy/jit/codegen/ia32/rgenop.py
Log:
(arigo) better arithmetics


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 21:45:49 2008
@@ -487,9 +487,8 @@
         return self.returnintvar(op)
 
     def genop_get_frame_base(self):
-        # XXX really?
         self.mc.MOV(eax, esp)
-        self.mc.SUB(eax, imm((self.stackdepth - 1) * WORD))
+        self.mc.ADD(eax, imm((self.stackdepth - 1) * WORD))
         return self.returnintvar(eax)
 
     def get_frame_info(self, vars_gv):
@@ -1076,9 +1075,10 @@
     def alloc_frame_place(self, kind, gv_initial_value=None):
         # XXX kind
         if gv_initial_value is not None:
-            return self.returnintvar(gv_initial_value.operand(self))
+            res = self.returnintvar(gv_initial_value.operand(self))
         else:
-            return self.returnintvar(None)
+            res = self.returnintvar(None)
+        return res
 
     def genop_absorb_place(self, v):
         return v
@@ -1478,7 +1478,7 @@
     def read_frame_var(T, base, info, index):
         assert T is lltype.Signed
         v = info[index]
-        value = peek_word_at(base + v.stackpos * WORD)
+        value = peek_word_at(base - v.stackpos * WORD)
         return value
 
     @staticmethod
@@ -1487,19 +1487,19 @@
         v = info[index]
         if isinstance(v, GenConst):
             return v
-        return IntConst(peek_word_at(base + v.stackpos * WORD))
+        return IntConst(peek_word_at(base - v.stackpos * WORD))
 
     @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_word_into(base - place.stackpos * WORD, value)
 
     @staticmethod
     @specialize.arg(0)
     def read_frame_place(T, base, place):
         assert T is lltype.Signed
-        return peek_word_at(base + place.stackpos * WORD)
+        return peek_word_at(base - place.stackpos * WORD)
 
 global_rgenop = RI386GenOp()
 RI386GenOp.constPrebuiltGlobal = global_rgenop.genconst


More information about the pypy-svn mailing list