Author: Maciej Fijalkowski <[email protected]>
Branch: fast-slowpath
Changeset: r65371:09e06e2eb839
Date: 2013-07-12 15:00 +0200
http://bitbucket.org/pypy/pypy/changeset/09e06e2eb839/

Log:    pass the first (fastpath) of the test

diff --git a/rpython/jit/backend/llgraph/runner.py 
b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -824,6 +824,7 @@
     def execute_cond_call(self, calldescr, cond, func, *args):
         if not cond:
             return
+        # cond_call can't have a return value
         self.execute_call(calldescr, func, *args)
 
     def execute_call(self, calldescr, func, *args):
diff --git a/rpython/jit/backend/llsupport/assembler.py 
b/rpython/jit/backend/llsupport/assembler.py
--- a/rpython/jit/backend/llsupport/assembler.py
+++ b/rpython/jit/backend/llsupport/assembler.py
@@ -106,6 +106,7 @@
                 kind='unicode')
         else:
             self.malloc_slowpath_unicode = None
+        self.cond_call_slowpath = [0, self._build_cond_call_slowpath(1)]
 
         self._build_stack_check_slowpath()
         self._build_release_gil(gc_ll_descr.gcrootmap)
diff --git a/rpython/jit/backend/test/runner_test.py 
b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -2293,6 +2293,7 @@
             assert self.cpu.get_int_value(frame, i) == i
         assert self.cpu.get_float_value(frame, 6) == 1.2
         assert self.cpu.get_float_value(frame, 7) == 3.4
+        xxx
         frame = self.cpu.execute_token(looptoken, 1, 1, 1, 2, 3, 4, 5, 1.2, 
3.4)
         assert called == [1]
         for i in range(4):
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -149,7 +149,7 @@
         mc.RET()
         self._frame_realloc_slowpath = mc.materialize(self.cpu.asmmemmgr, [])
 
-    def _build_call_slowpath(self, no_args):
+    def _build_cond_call_slowpath(self, no_args):
         """ This builds a general call slowpath, for whatever call happens to
         come.
         """
@@ -159,11 +159,12 @@
         assert no_args == 1
         mc.SUB(esp, imm(WORD))
         # first arg is always in edi
-        mc.CALL()
+        mc.CALL(imm(0))
         mc.ADD(esp, imm(WORD))
         self._pop_all_regs_from_frame(mc, [], self.cpu.supports_floats,
                                       callee_only=False)
         mc.RET()
+        return 0
 
     def _build_malloc_slowpath(self, kind):
         """ While arriving on slowpath, we have a gcpattern on stack 0.
@@ -2140,6 +2141,17 @@
     def label(self):
         self._check_frame_depth_debug(self.mc)
 
+    def cond_call(self, op, gcmap, cond_loc, call_loc, arglocs):
+        self.mc.CMP(cond_loc, cond_loc)
+        self.mc.J_il8(rx86.Conditions['Z'], 0) # patched later
+        jmp_adr = self.mc.get_relative_pos()
+        self.push_gcmap(self.mc, gcmap, mov=True)
+        self.mc.CALL(imm(self.cond_call_slowpath[len(arglocs)]))
+        # never any result value
+        offset = self.mc.get_relative_pos() - jmp_adr
+        assert 0 < offset <= 127
+        self.mc.overwrite(jmp_adr-1, chr(offset))        
+
     def malloc_cond(self, nursery_free_adr, nursery_top_adr, size, gcmap):
         assert size & (WORD-1) == 0     # must be correctly aligned
         self.mc.MOV(eax, heap(nursery_free_adr))
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -797,6 +797,16 @@
 
     consider_cond_call_gc_wb_array = consider_cond_call_gc_wb
 
+    def consider_cond_call(self, op):
+        assert op.result is None
+        args = op.getarglist()
+        assert len(args) == 1 + 2
+        self.make_sure_var_in_reg(args[2], selected_reg=edi)
+        loc_cond = self.make_sure_var_in_reg(args[0], args)
+        loc_call = self.make_sure_var_in_reg(args[1], args)
+        self.assembler.cond_call(op, self.get_gcmap(), loc_cond, loc_call,
+                                 [edi])
+
     def consider_call_malloc_nursery(self, op):
         size_box = op.getarg(0)
         assert isinstance(size_box, ConstInt)
diff --git a/rpython/jit/metainterp/executor.py 
b/rpython/jit/metainterp/executor.py
--- a/rpython/jit/metainterp/executor.py
+++ b/rpython/jit/metainterp/executor.py
@@ -346,6 +346,7 @@
                          rop.CALL_ASSEMBLER,
                          rop.COND_CALL_GC_WB,
                          rop.COND_CALL_GC_WB_ARRAY,
+                         rop.COND_CALL,
                          rop.DEBUG_MERGE_POINT,
                          rop.JIT_DEBUG,
                          rop.SETARRAYITEM_RAW,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to