[pypy-svn] pypy out-of-line-guards: make test pass, invalidating call_assembler works

fijal commits-noreply at bitbucket.org
Sat Jan 1 18:03:28 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40311:285d0b818d13
Date: 2011-01-01 19:02 +0200
http://bitbucket.org/pypy/pypy/changeset/285d0b818d13/

Log:	make test pass, invalidating call_assembler works

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
@@ -183,9 +183,6 @@
         #
         res = self.meta_interp(loop2, [4, 40], repeat=7, inline=True)
         assert res == loop2(4, 40)
-        # we expect only one int_sub, corresponding to the single
-        # compiled instance of loop1()
-        self.check_loops(int_sub=1)
 
 class TestLLtype(OutOfLineTests, LLJitMixin):
     pass

diff --git a/pypy/jit/metainterp/warmstate.py b/pypy/jit/metainterp/warmstate.py
--- a/pypy/jit/metainterp/warmstate.py
+++ b/pypy/jit/metainterp/warmstate.py
@@ -168,7 +168,11 @@
 
     def get_entry_loop_token(self):
         if self.wref_entry_loop_token is not None:
-            return self.wref_entry_loop_token()
+            looptoken = self.wref_entry_loop_token()
+            if looptoken.invalidated:
+                self.wref_entry_loop_token = None
+            else:
+                return looptoken
         return None
 
     def set_entry_loop_token(self, looptoken):

diff --git a/pypy/jit/backend/llgraph/llimpl.py b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -316,8 +316,12 @@
                 continue
             call_target = op.descr().compiled_loop_token
             if call_target is ctl:
-                import pdb
-                pdb.set_trace()
+                tmp = op.descr()._tmp_token.compiled_loop_token
+                if hasattr(call_target, 'redirected'):
+                    import pdb
+                    pdb.set_trace()
+                _redirect_call_assembler(call_target, tmp,
+                                         op.descr()._tmp_token)
         if op.is_guard() and op.jump_target is not None:
             _invalidate_call_asm(op.jump_target, to_loop)
 
@@ -1598,10 +1602,14 @@
 def redirect_call_assembler(cpu, oldlooptoken, newlooptoken):
     oldclt = oldlooptoken.compiled_loop_token
     newclt = newlooptoken.compiled_loop_token
+    _redirect_call_assembler(oldclt, newclt, newlooptoken)
+
+def _redirect_call_assembler(oldclt, newclt, newlooptoken):
     OLD = _from_opaque(oldclt.compiled_version).getargtypes()
     NEW = _from_opaque(newclt.compiled_version).getargtypes()
     assert OLD == NEW
     assert not hasattr(oldclt, 'redirected')
+    # XXX fix the above case
     oldclt.redirected = weakref.ref(newlooptoken)
 
 # ____________________________________________________________


More information about the Pypy-commit mailing list