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

arigo at codespeak.net arigo at codespeak.net
Wed Jun 3 21:39:56 CEST 2009


Author: arigo
Date: Wed Jun  3 21:39:53 2009
New Revision: 65561

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/gc.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/test/test_zrpy_gc.py
Log:
Use LOC_EBP_BASED instead of LOC_ESP_BASED now.
Fix in _compress_callshape() to accept negative numbers.


Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/gc.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/gc.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/gc.py	Wed Jun  3 21:39:53 2009
@@ -197,15 +197,17 @@
                  0]
         for loc in gclocs:
             assert isinstance(loc, MODRM)
-            shape.append(self.LOC_ESP_BASED | (4 * loc.position))
+            shape.append(self.LOC_EBP_BASED | (-4 * (1 + loc.position)))
         return shape
 
     def _compress_callshape(self, shape):
         # Similar to compress_callshape() in trackgcroot.py.  XXX a bit slowish
         result = []
         for loc in shape:
-            assert loc >= 0
-            loc = loc * 2
+            if loc < 0:
+                loc = (-loc) * 2 - 1
+            else:
+                loc = loc * 2
             flag = 0
             while loc >= 0x80:
                 result.append(int(loc & 0x7F) | flag)

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/test/test_zrpy_gc.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/test/test_zrpy_gc.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/backend/x86/test/test_zrpy_gc.py	Wed Jun  3 21:39:53 2009
@@ -32,7 +32,7 @@
     def entrypoint(args):
         r_list = []
         for i in range(20):
-            r = g(1000)
+            r = g(2000)
             r_list.append(r)
             rgc.collect()
         rgc.collect(); rgc.collect()
@@ -53,6 +53,7 @@
     #
     t = TranslationContext()
     t.config.translation.gc = gc
+    t.config.translation.gcconfig.debugprint = True
     for name, value in kwds.items():
         setattr(t.config.translation, name, value)
     t.buildannotator().build_types(f, [int])
@@ -113,12 +114,12 @@
 def test_GcRootMap_asmgcc():
     gcrootmap = GcRootMap_asmgcc()
     shape = gcrootmap._get_callshape([stack_pos(1), stack_pos(55)])
-    assert shape == [6, 1, 5, 9, 2, 0, 4|3, 220|3]
+    assert shape == [6, 1, 5, 9, 2, 0, -8|2, -224|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, 62, 14, 0, 4, 18, 10, 2, 12]):
+    for i, expected in enumerate([131, 59, 11, 0, 4, 18, 10, 2, 12]):
         assert p[i] == expected
     #
     retaddr = rffi.cast(llmemory.Address, 1234567890)
@@ -171,6 +172,7 @@
                 y.foo = j+1
                 y.next = x.next
                 x.next = y
+            assert x.next.foo == 101
             total = 0
             y = x
             for j in range(101):



More information about the Pypy-commit mailing list