[pypy-svn] pypy out-of-line-guards: more in-progress, fighting with hg

fijal commits-noreply at bitbucket.org
Fri Dec 31 10:36:52 CET 2010


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40307:b292470e66ed
Date: 2010-12-31 11:36 +0200
http://bitbucket.org/pypy/pypy/changeset/b292470e66ed/

Log:	more in-progress, fighting with hg

diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -753,6 +753,8 @@
     # memory and the ResumeGuards.
     compiled_loop_token = None
 
+    _tmp_token = None # a token that keeps tmpcallback
+
     invalidated = False
     # if True means looptoken was invalidated by setting some field
     # listed in jit_invariant_setfield that was read in this loop

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
@@ -256,6 +256,9 @@
         cell.set_entry_loop_token(entry_loop_token)
         cell.counter = -1       # valid entry bridge attached
         if old_token is not None:
+            entry_loop_token._tmp_token = old_token
+            # keep tmp token in case we invalidate this loop, so loops
+            # can be redirected back to _tmp_token
             self.cpu.redirect_call_assembler(old_token, entry_loop_token)
             # entry_loop_token is also kept alive by any loop that used
             # to point to old_token.  Actually freeing old_token early
@@ -568,14 +571,18 @@
             # 'redboxes' is only used to know the types of red arguments
             cell = self.jit_cell_at_key(greenkey)
             entry_loop_token = cell.get_entry_loop_token()
-            if entry_loop_token is None:
+            if entry_loop_token is None or entry_loop_token._tmp_token is None:
                 from pypy.jit.metainterp.compile import compile_tmp_callback
                 if cell.counter == -1:    # used to be a valid entry bridge,
                     cell.counter = 0      # but was freed in the meantime.
                 memmgr = warmrunnerdesc.memory_manager
-                entry_loop_token = compile_tmp_callback(cpu, jd, greenkey,
-                                                        redboxes, memmgr)
-                cell.set_entry_loop_token(entry_loop_token)
+                tmp_token = compile_tmp_callback(cpu, jd, greenkey,
+                                                 redboxes, memmgr)
+                if entry_loop_token is None:
+                    entry_loop_token = tmp_token
+                    cell.set_entry_loop_token(entry_loop_token)
+                else:
+                    entry_loop_token._tmp_token = tmp_token
             return entry_loop_token
         self.get_assembler_token = get_assembler_token
         


More information about the Pypy-commit mailing list