Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r60001:5af5c9bc65e6
Date: 2013-01-12 21:42 +0200
http://bitbucket.org/pypy/pypy/changeset/5af5c9bc65e6/

Log:    fix fix fix

diff --git a/pypy/jit/backend/test/runner_test.py 
b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -342,7 +342,7 @@
             
             def __setattr__(self, name, value):
                 if (name == 'index' or name == '_carry_around_for_tests'
-                        or name == '_TYPE'):
+                        or name == '_TYPE' or name == '_cpu'):
                     return AbstractFailDescr.__setattr__(self, name, value)
                 py.test.fail("finish descrs should not be touched")
         faildescr = UntouchableFailDescr() # to check that is not touched
diff --git a/pypy/jit/backend/x86/assembler.py 
b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -12,36 +12,25 @@
 from pypy.jit.backend.model import CompiledLoopToken
 from pypy.jit.backend.x86.regalloc import (RegAlloc, get_ebp_ofs, _get_scale,
     gpr_reg_mgr_cls, xmm_reg_mgr_cls, _valid_addressing_size)
-
 from pypy.jit.backend.x86.arch import (FRAME_FIXED_SIZE, FORCE_INDEX_OFS, WORD,
-                                       IS_X86_32, IS_X86_64,
-                                       JITFRAME_FIXED_SIZE)
-
-from pypy.jit.backend.x86.regloc import (eax, ecx, edx, ebx,
-                                         esp, ebp, esi, edi,
-                                         xmm0, xmm1, xmm2, xmm3,
-                                         xmm4, xmm5, xmm6, xmm7,
-                                         r8, r9, r10, r11,
-                                         r12, r13, r14, r15,
-                                         X86_64_SCRATCH_REG,
-                                         X86_64_XMM_SCRATCH_REG,
-                                         RegLoc, StackLoc, ConstFloatLoc,
-                                         ImmedLoc, AddressLoc, imm,
-                                         imm0, imm1, FloatImmedLoc)
-
+                                       IS_X86_32, IS_X86_64)
+from pypy.jit.backend.x86.regloc import (eax, ecx, edx, ebx, esp, ebp, esi, 
edi,
+    xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, r8, r9, r10, r11,
+    r12, r13, r14, r15, X86_64_SCRATCH_REG, X86_64_XMM_SCRATCH_REG,
+    RegLoc, StackLoc, ConstFloatLoc, ImmedLoc, AddressLoc, imm,
+    imm0, imm1, FloatImmedLoc, RawStackLoc)
 from pypy.rlib.objectmodel import we_are_translated, specialize
-from pypy.jit.backend.x86 import rx86, regloc, codebuf
+from pypy.jit.backend.x86 import rx86, codebuf
 from pypy.jit.metainterp.resoperation import rop, ResOperation
 from pypy.jit.backend.x86 import support
 from pypy.rlib.debug import (debug_print, debug_start, debug_stop,
-                             have_debug_prints, fatalerror)
+                             have_debug_prints)
 from pypy.rlib import rgc
 from pypy.rlib.clibffi import FFI_DEFAULT_ABI
 from pypy.jit.backend.x86.jump import remap_frame_layout
 from pypy.jit.codewriter.effectinfo import EffectInfo
 from pypy.jit.codewriter import longlong
 from pypy.rlib.rarithmetic import intmask
-from pypy.rlib import longlong2float
 from pypy.rlib.objectmodel import compute_unique_id
 
 # darwin requires the stack to be 16 bytes aligned on calls. Same for gcc 
4.5.0,
@@ -1903,10 +1892,11 @@
     def genop_finish(self, op, arglocs, result_loc):
         if len(arglocs) == 2:
             [return_val, argloc] = arglocs
-            if op.getarg(0).type == FLOAT:
-                self.mc.MOVSD_bx(0, return_val.value)
+            if op.getarg(0).type == FLOAT and not IS_X86_64:
+                size = WORD * 2
             else:
-                self.mc.MOV_br(0, return_val.value)
+                size = WORD
+            self.save_into_mem(raw_stack(0), return_val, imm(size))
         else:
             [argloc] = arglocs
         if argloc is not eax:
@@ -2438,6 +2428,9 @@
 def mem(loc, offset):
     return AddressLoc(loc, imm0, 0, offset)
 
+def raw_stack(offset, type=INT):
+    return RawStackLoc(offset, type)
+
 def heap(addr):
     return AddressLoc(ImmedLoc(addr), imm0, 0, 0)
 
diff --git a/pypy/jit/backend/x86/regloc.py b/pypy/jit/backend/x86/regloc.py
--- a/pypy/jit/backend/x86/regloc.py
+++ b/pypy/jit/backend/x86/regloc.py
@@ -41,19 +41,15 @@
 
     def find_unused_reg(self): return eax
 
-class StackLoc(AssemblerLocation):
+class RawStackLoc(AssemblerLocation):
+    """ The same as stack location, but does not know it's position.
+    Mostly usable for raw frame access
+    """
     _immutable_ = True
     _location_code = 'b'
 
-    def __init__(self, position, ebp_offset, type):
-        # _getregkey() returns self.value; the value returned must not
-        # conflict with RegLoc._getregkey().  It doesn't a bit by chance,
-        # so let it fail the following assert if it no longer does.
-        assert ebp_offset >= 0
-        #assert not (0 <= ebp_offset < 8 + 8 * IS_X86_64)
-        self.position = position
-        self.value = ebp_offset
-        # One of INT, REF, FLOAT
+    def __init__(self, value, type):
+        self.value = value
         self.type = type
 
     def _getregkey(self):
@@ -70,6 +66,18 @@
     def assembler(self):
         return repr(self)
 
+class StackLoc(RawStackLoc):
+    def __init__(self, position, ebp_offset, type):
+        # _getregkey() returns self.value; the value returned must not
+        # conflict with RegLoc._getregkey().  It doesn't a bit by chance,
+        # so let it fail the following assert if it no longer does.
+        assert ebp_offset >= 0
+        #assert not (0 <= ebp_offset < 8 + 8 * IS_X86_64)
+        self.position = position
+        self.value = ebp_offset
+        # One of INT, REF, FLOAT
+        self.type = type
+
 class RegLoc(AssemblerLocation):
     _immutable_ = True
     def __init__(self, regnum, is_xmm):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to