[pypy-commit] pypy arm-backend-2: refactor test_compile_asmlen a bit to make it work the ARM backend

bivab noreply at buildbot.pypy.org
Thu Jan 26 10:45:21 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r51777:fb43a79417b7
Date: 2012-01-23 17:06 +0100
http://bitbucket.org/pypy/pypy/changeset/fb43a79417b7/

Log:	refactor test_compile_asmlen a bit to make it work the ARM backend

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
@@ -3174,7 +3174,6 @@
                          'float', descr=calldescr)
             assert res.getfloat() == expected
 
-
     def test_compile_loop_with_target(self):
         i0 = BoxInt()
         i1 = BoxInt()
@@ -3220,10 +3219,10 @@
         from pypy.jit.backend.llsupport.llmodel import AbstractLLCPU
         if not isinstance(self.cpu, AbstractLLCPU):
             py.test.skip("pointless test on non-asm")
-        from pypy.jit.backend.x86.tool.viewcode import machine_code_dump
+        machine_code_dump = self.get_machine_code_dump_func()
         import ctypes
         ops = """
-        [i2]
+        [i3, i2]
         i0 = same_as(i2)    # but forced to be in a register
         label(i0, descr=1)
         i1 = int_add(i0, i0)
@@ -3254,18 +3253,17 @@
         def checkops(mc, ops):
             assert len(mc) == len(ops)
             for i in range(len(mc)):
-                assert mc[i].split("\t")[-1].startswith(ops[i])
-            
+                assert mc[i].split("\t")[2].startswith(ops[i])
+
         data = ctypes.string_at(info.asmaddr, info.asmlen)
         mc = list(machine_code_dump(data, info.asmaddr, cpuname))
-        lines = [line for line in mc if line.count('\t') == 2]
+        lines = [line for line in mc if line.count('\t') >= 2]
         checkops(lines, self.add_loop_instructions)
         data = ctypes.string_at(bridge_info.asmaddr, bridge_info.asmlen)
         mc = list(machine_code_dump(data, bridge_info.asmaddr, cpuname))
-        lines = [line for line in mc if line.count('\t') == 2]
+        lines = [line for line in mc if line.count('\t') >= 2]
         checkops(lines, self.bridge_loop_instructions)
 
-
     def test_compile_bridge_with_target(self):
         # This test creates a loopy piece of code in a bridge, and builds another
         # unrelated loop that ends in a jump directly to this loopy bit of code.
diff --git a/pypy/jit/backend/x86/test/test_runner.py b/pypy/jit/backend/x86/test/test_runner.py
--- a/pypy/jit/backend/x86/test/test_runner.py
+++ b/pypy/jit/backend/x86/test/test_runner.py
@@ -40,6 +40,10 @@
         # the 'mov' is part of the 'jmp' so far
         bridge_loop_instructions = ['lea', 'mov', 'jmp']
 
+    def get_machine_code_dump_func(self):
+        from pypy.jit.backend.x86.tool.viewcode import machine_code_dump
+        return machine_code_dump
+
     def setup_method(self, meth):
         self.cpu = CPU(rtyper=None, stats=FakeStats())
         self.cpu.setup_once()


More information about the pypy-commit mailing list