[pypy-svn] r64020 - in pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86: . test

fijal at codespeak.net fijal at codespeak.net
Mon Apr 13 07:38:34 CEST 2009


Author: fijal
Date: Mon Apr 13 07:38:31 2009
New Revision: 64020

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py
Log:
a test and a fix. we obviously need more tests for shortcuts


Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py	Mon Apr 13 07:38:31 2009
@@ -99,7 +99,7 @@
 
     def __init__(self, cpu, translate_support_code=False):
         self.cpu = cpu
-        self.verbose = True
+        self.verbose = False
         self.rtyper = cpu.rtyper
         self.malloc_func_addr = 0
         self._exception_data = lltype.nullptr(rffi.CArray(lltype.Signed))
@@ -368,10 +368,10 @@
             if isinstance(op.args[0], Const):
                 self.mc.CMP(arglocs[1], arglocs[0])
                 if guard_op.opnum == rop.GUARD_FALSE:
-                    name = 'J' + rev_cond
+                    name = 'J' + false_rev_cond
                     self.implement_guard(addr, guard_op, getattr(self.mc, name))
                 else:
-                    name = 'J' + false_rev_cond
+                    name = 'J' + rev_cond
                     self.implement_guard(addr, guard_op, getattr(self.mc, name))
             else:
                 self.mc.CMP(arglocs[0], arglocs[1])

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py	Mon Apr 13 07:38:31 2009
@@ -455,6 +455,22 @@
         op = self.cpu.execute_operations(loop, [p])
         assert op.args[0].value == 0
 
+    def test_int_eq_guard_fals(self):
+        v = BoxInt(1)
+        res = BoxInt()
+        ops = [
+            ResOperation(rop.INT_EQ, [ConstInt(0), v], res),
+            ResOperation(rop.GUARD_FALSE, [res], None),
+            ResOperation(rop.FAIL, [ConstInt(0)], None),
+            ]
+        ops[1].suboperations = [ResOperation(rop.FAIL, [ConstInt(1)], None)]
+        loop = TreeLoop('name')
+        loop.operations = ops
+        loop.inputargs = [v]
+        self.cpu.compile_operations(loop)
+        op = self.cpu.execute_operations(loop, [v])
+        assert op.args[0].value == 0
+
     def test_overflow_mc(self):
         from pypy.jit.backend.x86.assembler import MachineCodeBlockWrapper
 



More information about the Pypy-commit mailing list