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

arigo at codespeak.net arigo at codespeak.net
Sun Aug 23 18:41:58 CEST 2009


Author: arigo
Date: Sun Aug 23 18:41:57 2009
New Revision: 67129

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py
Log:
(benjamin, arigo)
Handle constants.


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py	Sun Aug 23 18:41:57 2009
@@ -21,6 +21,8 @@
         srccount[dst._getregkey()] = 0
     for i in range(len(dst_locations)):
         src = src_locations[i]
+        if isinstance(src, IMM32):
+            continue
         key = src._getregkey()
         if key in srccount:
             if key == dst_locations[i]._getregkey():
@@ -38,9 +40,10 @@
                 srccount[key] = -1       # means "it's done"
                 pending_dests -= 1
                 src = src_locations[i]
-                key = src._getregkey()
-                if key in srccount:
-                    srccount[key] -= 1
+                if not isinstance(src, IMM32):
+                    key = src._getregkey()
+                    if key in srccount:
+                        srccount[key] -= 1
                 _move(assembler, src, dst, tmpreg)
                 progress = True
         if not progress:

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py	Sun Aug 23 18:41:57 2009
@@ -121,3 +121,24 @@
                           ('load', s2, ecx),
                           ('store', ecx, s3),
                           ('pop', s2)])
+
+def test_constants():
+    assembler = MockAssembler()
+    c3 = imm(3)
+    remap_stack_layout(assembler, [c3], [eax], '?')
+    assert assembler.ops == [('load', c3, eax)]
+    assembler = MockAssembler()
+    s12 = stack_pos(12)
+    remap_stack_layout(assembler, [c3], [s12], '?')
+    assert assembler.ops == [('store', c3, s12)]
+
+def test_constants_and_cycle():
+    assembler = MockAssembler()
+    c3 = imm(3)
+    s12 = stack_pos(13)
+    remap_stack_layout(assembler, [ebx, c3,  s12],
+                                  [s12, eax, ebx], edi)
+    assert assembler.ops == [('load', c3, eax),
+                             ('push', s12),
+                             ('store', ebx, s12),
+                             ('pop', ebx)]



More information about the Pypy-commit mailing list