[pypy-svn] pypy out-of-line-guards: Fix invalidating of assembler

fijal commits-noreply at bitbucket.org
Sun Jan 2 15:08:19 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40325:9e432bf82672
Date: 2011-01-02 16:07 +0200
http://bitbucket.org/pypy/pypy/changeset/9e432bf82672/

Log:	Fix invalidating of assembler

diff --git a/pypy/jit/metainterp/test/test_outofline.py b/pypy/jit/metainterp/test/test_outofline.py
--- a/pypy/jit/metainterp/test/test_outofline.py
+++ b/pypy/jit/metainterp/test/test_outofline.py
@@ -181,7 +181,7 @@
                 possibly_invalidate(r, a)
             return r
         #
-        res = self.meta_interp(loop2, [4, 40], repeat=7, inline=True)
+        res = self.meta_interp(loop2, [4, 40], inline=True)
         assert res == loop2(4, 40)
 
 class TestLLtype(OutOfLineTests, LLJitMixin):

diff --git a/pypy/jit/backend/x86/runner.py b/pypy/jit/backend/x86/runner.py
--- a/pypy/jit/backend/x86/runner.py
+++ b/pypy/jit/backend/x86/runner.py
@@ -144,18 +144,28 @@
     def get_invalidate_asm(self, TP, fieldname):
         def invalidate_asm(arg):
             next = getattr(arg, fieldname)
+
+            all = []
             while next:
-                prev = next
-                llx =  llmemory.weakref_deref(ropaque.ROPAQUE, prev.address)
+                llx = llmemory.weakref_deref(ropaque.ROPAQUE, next.address)
                 if llx:
-                    x = ropaque.cast_ropaque_to_obj(history.LoopToken, llx)
-                    x.invalidated = True
-                    x._x86_asm_invalidated[0] = 1
-                    for elem in x._back_looptokens:
-                        token = elem()
-                        if token:
-                            self.redirect_call_assembler(token, x._tmp_token)
+                    all.append(ropaque.cast_ropaque_to_obj(history.LoopToken,
+                                                           llx))
                 next = next.next
+
+            while all:
+                next = all.pop()
+                next.invalidated = True
+                next._x86_asm_invalidated[0] = 1
+                for elem in next._back_looptokens_call_asm:
+                    token = elem()
+                    if token:
+                        self.redirect_call_assembler(next, next._tmp_token)
+                        break
+                for elem in next._back_looptokens:
+                    elem = elem()
+                    if elem:
+                        all.append(elem)
         return invalidate_asm
 
     def redirect_call_assembler(self, oldlooptoken, newlooptoken):


More information about the Pypy-commit mailing list