[pypy-svn] r77306 - in pypy/branch/jit-str/pypy/jit/backend: test x86 x86/test

arigo at codespeak.net arigo at codespeak.net
Thu Sep 23 17:39:59 CEST 2010


Author: arigo
Date: Thu Sep 23 17:39:57 2010
New Revision: 77306

Added:
   pypy/branch/jit-str/pypy/jit/backend/x86/test/test_string.py   (contents, props changed)
Modified:
   pypy/branch/jit-str/pypy/jit/backend/test/runner_test.py
   pypy/branch/jit-str/pypy/jit/backend/x86/regalloc.py
   pypy/branch/jit-str/pypy/jit/backend/x86/rx86.py
Log:
Add the tests from the front-end here too, and fix the failures
in register allocation caught by them.


Modified: pypy/branch/jit-str/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/backend/test/runner_test.py	(original)
+++ pypy/branch/jit-str/pypy/jit/backend/test/runner_test.py	Thu Sep 23 17:39:57 2010
@@ -816,14 +816,20 @@
 
     def test_copystrcontent(self):
         s_box = self.alloc_string("abcdef")
-        for srcstart_box in [BoxInt(2), ConstInt(2)]:
-            for dststart_box in [BoxInt(3), ConstInt(3)]:
-                for length_box in [BoxInt(4), ConstInt(4)]:
-                    r_box = self.alloc_string("!???????!")
-                    self.execute_operation(rop.COPYSTRCONTENT,
-                                           [s_box, r_box, srcstart_box,
-                                            dststart_box, length_box], 'void')
-                    assert self.look_string(r_box) == "!??cdef?!"
+        for s_box in [s_box, s_box.constbox()]:
+            for srcstart_box in [BoxInt(2), ConstInt(2)]:
+                for dststart_box in [BoxInt(3), ConstInt(3)]:
+                    for length_box in [BoxInt(4), ConstInt(4)]:
+                        for r_box_is_const in [False, True]:
+                            r_box = self.alloc_string("!???????!")
+                            if r_box_is_const:
+                                r_box = r_box.constbox()
+                                self.execute_operation(rop.COPYSTRCONTENT,
+                                                       [s_box, r_box,
+                                                        srcstart_box,
+                                                        dststart_box,
+                                                        length_box], 'void')
+                                assert self.look_string(r_box) == "!??cdef?!"
 
     def test_do_unicode_basic(self):
         u = self.cpu.bh_newunicode(5)

Modified: pypy/branch/jit-str/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/branch/jit-str/pypy/jit/backend/x86/regalloc.py	Thu Sep 23 17:39:57 2010
@@ -955,6 +955,8 @@
         self._gen_address_inside_string(base_loc, ofs_loc, dstaddr_loc)
         # call memcpy()
         length_loc = self.loc(op.args[4])
+        self.rm.before_call()
+        self.xrm.before_call()
         self.assembler._emit_call(imm(self.assembler.memcpy_addr),
                                   [dstaddr_loc, srcaddr_loc, length_loc])
         self.rm.possibly_free_var(op.args[4])

Modified: pypy/branch/jit-str/pypy/jit/backend/x86/rx86.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/backend/x86/rx86.py	(original)
+++ pypy/branch/jit-str/pypy/jit/backend/x86/rx86.py	Thu Sep 23 17:39:57 2010
@@ -506,6 +506,7 @@
     LEA32_rb = insn(rex_w, '\x8D', register(1,8),stack_bp(2,force_32bits=True))
     LEA_ra = insn(rex_w, '\x8D', register(1, 8), mem_reg_plus_scaled_reg_plus_const(2))
     LEA_rm = insn(rex_w, '\x8D', register(1, 8), mem_reg_plus_const(2))
+    LEA_rj = insn(rex_w, '\x8D', register(1, 8), '\x05', immediate(2))
 
     CALL_l = insn('\xE8', relative(1))
     CALL_r = insn(rex_nw, '\xFF', register(1), chr(0xC0 | (2<<3)))

Added: pypy/branch/jit-str/pypy/jit/backend/x86/test/test_string.py
==============================================================================
--- (empty file)
+++ pypy/branch/jit-str/pypy/jit/backend/x86/test/test_string.py	Thu Sep 23 17:39:57 2010
@@ -0,0 +1,9 @@
+import py
+from pypy.jit.metainterp.test import test_string
+from pypy.jit.backend.x86.test.test_basic import Jit386Mixin
+
+class TestString(Jit386Mixin, test_string.StringTests):
+    # for the individual tests see
+    # ====> ../../../metainterp/test/test_string.py
+    CALL = 'call'
+    CALL_PURE = 'call_pure'



More information about the Pypy-commit mailing list