[pypy-svn] r75023 - in pypy/trunk/pypy/jit: backend backend/x86 metainterp

arigo at codespeak.net arigo at codespeak.net
Wed Jun 2 21:17:01 CEST 2010


Author: arigo
Date: Wed Jun  2 21:16:59 2010
New Revision: 75023

Modified:
   pypy/trunk/pypy/jit/backend/model.py
   pypy/trunk/pypy/jit/backend/x86/assembler.py
   pypy/trunk/pypy/jit/backend/x86/regalloc.py
   pypy/trunk/pypy/jit/metainterp/pyjitpl.py
Log:
Revert r75002, r75004 and r75012.  Until I find out why,
for now it gives crashes.


Modified: pypy/trunk/pypy/jit/backend/model.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/model.py	(original)
+++ pypy/trunk/pypy/jit/backend/model.py	Wed Jun  2 21:16:59 2010
@@ -6,10 +6,7 @@
     # assembler_helper_ptr - a pointer to helper to call after a direct
     #                        assembler call
     portal_calldescr = None
-    done_with_this_frame_void_v = -1
     done_with_this_frame_int_v = -1
-    done_with_this_frame_ref_v = -1
-    done_with_this_frame_float_v = -1
 
     def __init__(self):
         self.fail_descr_list = []

Modified: pypy/trunk/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/assembler.py	Wed Jun  2 21:16:59 2010
@@ -1427,72 +1427,28 @@
         descr = op.descr
         assert isinstance(descr, LoopToken)
         assert len(arglocs) - 2 == len(descr._x86_arglocs[0])
-        #
-        # Write a call to the direct_bootstrap_code of the target assembler
         self._emit_call(rel32(descr._x86_direct_bootstrap_code), arglocs, 2,
                         tmp=eax)
         mc = self._start_block()
-        if op.result is None:
-            assert result_loc is None
-            value = self.cpu.done_with_this_frame_void_v
-        else:
-            kind = op.result.type
-            if kind == INT:
-                assert result_loc is eax
-                value = self.cpu.done_with_this_frame_int_v
-            elif kind == REF:
-                assert result_loc is eax
-                value = self.cpu.done_with_this_frame_ref_v
-            elif kind == FLOAT:
-                value = self.cpu.done_with_this_frame_float_v
-            else:
-                raise AssertionError(kind)
-        mc.CMP(eax, imm(value))
-        mc.JE(rel8_patched_later)    # goto B if we get 'done_with_this_frame'
+        mc.CMP(eax, imm(self.cpu.done_with_this_frame_int_v))
+        mc.JE(rel8_patched_later)
         je_location = mc.get_relative_pos()
-        #
-        # Path A: use assembler_helper_adr
         self._emit_call(rel32(self.assembler_helper_adr), [eax, arglocs[1]], 0,
                         tmp=ecx, force_mc=True, mc=mc)
-        if isinstance(result_loc, MODRM64):
-            mc.FSTP(result_loc)
-        #else: result_loc is already either eax or None, checked below
-        if op.result is not None:
-            mc.JMP(rel8_patched_later)     # done
-            jmp_location = mc.get_relative_pos()
-            #
-            # Path B: load the return value directly from fail_boxes_xxx[0]
-            offset = jmp_location - je_location
-            assert 0 < offset <= 127
-            mc.overwrite(je_location - 1, [chr(offset)])
-            #
-            kind = op.result.type
-            if kind == FLOAT:
-                xmmtmp = X86XMMRegisterManager.all_regs[0]
-                adr = self.fail_boxes_float.get_addr_for_num(0)
-                mc.MOVSD(xmmtmp, heap64(adr))
-                mc.MOVSD(result_loc, xmmtmp)
-            else:
-                assert result_loc is eax
-                if kind == INT:
-                    adr = self.fail_boxes_int.get_addr_for_num(0)
-                    mc.MOV(eax, heap(adr))
-                elif kind == REF:
-                    adr = self.fail_boxes_ptr.get_addr_for_num(0)
-                    mc.XOR(eax, eax)
-                    mc.XCHG(eax, heap(adr))
-                else:
-                    raise AssertionError(kind)
-        else:
-            # in that case, don't generate a JMP at all,
-            # because "Path B" is empty
-            jmp_location = je_location
-        #
-        # Here we join Path A and Path B again
+        mc.JMP(rel8_patched_later)
+        jmp_location = mc.get_relative_pos()
+        offset = jmp_location - je_location
+        assert 0 < offset <= 127
+        mc.overwrite(je_location - 1, [chr(offset)])
+        mc.MOV(eax, heap(self.fail_boxes_int.get_addr_for_num(0)))
         offset = mc.get_relative_pos() - jmp_location
         assert 0 < offset <= 127
         mc.overwrite(jmp_location - 1, [chr(offset)])
         self._stop_block()
+        if isinstance(result_loc, MODRM64):
+            self.mc.FSTP(result_loc)
+        else:
+            assert result_loc is eax or result_loc is None
         self.mc.CMP(mem(ebp, FORCE_INDEX_OFS), imm(0))
         return self.implement_guard(addr, self.mc.JL)
 

Modified: pypy/trunk/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/regalloc.py	Wed Jun  2 21:16:59 2010
@@ -656,7 +656,7 @@
         portal_calldescr = self.assembler.cpu.portal_calldescr
         size = portal_calldescr.get_result_size(self.translate_support_code)
         vable_index = self.assembler.cpu.index_of_virtualizable
-        if vable_index >= 0:
+        if vable_index != -1:
             self.rm._sync_var(op.args[vable_index])
             vable = self.fm.loc(op.args[vable_index], 1)
         else:

Modified: pypy/trunk/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/pyjitpl.py	Wed Jun  2 21:16:59 2010
@@ -1126,10 +1126,8 @@
 
         self.__dict__.update(compile.make_done_loop_tokens())
         # store this information for fastpath of call_assembler
-        name = self.result_type
-        tokens = getattr(self, 'loop_tokens_done_with_this_frame_%s' % name)
-        num = self.cpu.get_fail_descr_number(tokens[0].finishdescr)
-        setattr(self.cpu, 'done_with_this_frame_%s_v' % name, num)
+        d = self.loop_tokens_done_with_this_frame_int[0].finishdescr
+        self.cpu.done_with_this_frame_int_v = self.cpu.get_fail_descr_number(d)
 
     def _freeze_(self):
         return True



More information about the Pypy-commit mailing list