[pypy-svn] r75284 - in pypy/branch/jit-call-assembler/pypy/jit: backend/x86 metainterp

arigo at codespeak.net arigo at codespeak.net
Fri Jun 11 20:11:29 CEST 2010


Author: arigo
Date: Fri Jun 11 20:11:26 2010
New Revision: 75284

Modified:
   pypy/branch/jit-call-assembler/pypy/jit/backend/x86/assembler.py
   pypy/branch/jit-call-assembler/pypy/jit/metainterp/virtualizable.py
   pypy/branch/jit-call-assembler/pypy/jit/metainterp/warmspot.py
Log:
Fix for r75282.  The CALL_ASSEMBLER operation is really really really
becoming far too much of a special-case...


Modified: pypy/branch/jit-call-assembler/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/jit-call-assembler/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/jit-call-assembler/pypy/jit/backend/x86/assembler.py	Fri Jun 11 20:11:26 2010
@@ -1394,15 +1394,26 @@
         if isinstance(result_loc, MODRM64):
             mc.FSTP(result_loc)
         #else: result_loc is already either eax or None, checked below
+        mc.JMP(rel8_patched_later)     # done
+        jmp_location = mc.get_relative_pos()
+        #
+        # Path B: fast path.  Must load the return value, and reset the token
+        offset = jmp_location - je_location
+        assert 0 < offset <= 127
+        mc.overwrite(je_location - 1, [chr(offset)])
+        #
+        # Reset the vable token --- XXX really too much special logic here:-(
+        if self.cpu.index_of_virtualizable >= 0:
+            from pypy.jit.backend.llsupport.descr import BaseFieldDescr
+            fielddescr = self.cpu.vable_token_descr
+            assert isinstance(fielddescr, BaseFieldDescr)
+            ofs = fielddescr.offset
+            mc.MOV(eax, arglocs[1])
+            mc.MOV(addr_add(eax, imm(ofs)), imm(0))
+            # in the line above, TOKEN_NONE = 0
+        #
         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)])
-            #
+            # load the return value from fail_boxes_xxx[0]
             kind = op.result.type
             if kind == FLOAT:
                 xmmtmp = X86XMMRegisterManager.all_regs[0]
@@ -1420,14 +1431,10 @@
                     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
         offset = mc.get_relative_pos() - jmp_location
-        assert 0 < offset <= 127
+        assert 0 <= offset <= 127
         mc.overwrite(jmp_location - 1, [chr(offset)])
         self._stop_block()
         self.mc.CMP(mem(ebp, FORCE_INDEX_OFS), imm(0))

Modified: pypy/branch/jit-call-assembler/pypy/jit/metainterp/virtualizable.py
==============================================================================
--- pypy/branch/jit-call-assembler/pypy/jit/metainterp/virtualizable.py	(original)
+++ pypy/branch/jit-call-assembler/pypy/jit/metainterp/virtualizable.py	Fri Jun 11 20:11:26 2010
@@ -11,7 +11,7 @@
 
 
 class VirtualizableInfo:
-    TOKEN_NONE            = 0
+    TOKEN_NONE            = 0      # must be 0 -- see also x86.call_assembler
     TOKEN_TRACING_RESCALL = -1
 
     def __init__(self, warmrunnerdesc):

Modified: pypy/branch/jit-call-assembler/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/jit-call-assembler/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/jit-call-assembler/pypy/jit/metainterp/warmspot.py	Fri Jun 11 20:11:26 2010
@@ -604,8 +604,10 @@
         if vinfo is not None:
             self.cpu.index_of_virtualizable = (vinfo.index_of_virtualizable -
                                                self.num_green_args)
+            self.cpu.vable_token_descr = vinfo.vable_token_descr
         else:
             self.cpu.index_of_virtualizable = -1
+            self.cpu.vable_token_descr = None
 
         # ____________________________________________________________
         # Now mutate origportalgraph to end with a call to portal_runner_ptr



More information about the Pypy-commit mailing list