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

arigo at codespeak.net arigo at codespeak.net
Mon Aug 24 19:44:34 CEST 2009


Author: arigo
Date: Mon Aug 24 19:44:33 2009
New Revision: 67173

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_zrpy_gc.py
Log:
Rumble rumble rumble.  Fix this formula to match the
formula in regalloc.py.  Also fix the test to fail
because of it (thanks Samuele).


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py	Mon Aug 24 19:44:33 2009
@@ -241,7 +241,7 @@
         for loc in gclocs:
             assert isinstance(loc, MODRM)
             assert loc.is_relative_to_ebp()
-            shape.append(self.LOC_EBP_BASED | (-4 * (1 + loc.position)))
+            shape.append(self.LOC_EBP_BASED | (-4 * (4 + loc.position)))
         return shape
 
     def _compress_callshape(self, shape):

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_zrpy_gc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_zrpy_gc.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_zrpy_gc.py	Mon Aug 24 19:44:33 2009
@@ -116,12 +116,17 @@
 def test_GcRootMap_asmgcc():
     gcrootmap = GcRootMap_asmgcc()
     shape = gcrootmap._get_callshape([stack_pos(1), stack_pos(55)])
-    assert shape == [6, -2, -6, -10, 2, 0, -8|2, -224|2]
+    num1 = stack_pos(1).ofs_relative_to_ebp()
+    num2 = stack_pos(55).ofs_relative_to_ebp()
+    assert shape == [6, -2, -6, -10, 2, 0, num1|2, num2|2]
     #
     shapeaddr = gcrootmap.encode_callshape([stack_pos(1), stack_pos(55)])
     PCALLSHAPE = lltype.Ptr(GcRootMap_asmgcc.CALLSHAPE_ARRAY)
     p = llmemory.cast_adr_to_ptr(shapeaddr, PCALLSHAPE)
-    for i, expected in enumerate([131, 59, 11, 0, 4, 19, 11, 3, 12]):
+    num1a = -2*(num1|2)-1
+    num2a = ((-2*(num2|2)-1) >> 7) | 128
+    num2b = (-2*(num2|2)-1) & 127
+    for i, expected in enumerate([num2a, num2b, num1a, 0, 4, 19, 11, 3, 12]):
         assert p[i] == expected
     #
     retaddr = rffi.cast(llmemory.Address, 1234567890)



More information about the Pypy-commit mailing list