[pypy-svn] r79310 - pypy/branch/jit-free/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Sun Nov 21 16:44:59 CET 2010


Author: arigo
Date: Sun Nov 21 16:44:58 2010
New Revision: 79310

Modified:
   pypy/branch/jit-free/pypy/jit/metainterp/warmstate.py
Log:
An essential fix for a rare case.  Unfortunately, it's obviously a bug fix,
but writing a test is a total mess :-(


Modified: pypy/branch/jit-free/pypy/jit/metainterp/warmstate.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/metainterp/warmstate.py	(original)
+++ pypy/branch/jit-free/pypy/jit/metainterp/warmstate.py	Sun Nov 21 16:44:58 2010
@@ -258,9 +258,9 @@
     def attach_unoptimized_bridge_from_interp(self, greenkey,
                                               entry_loop_token):
         cell = self.jit_cell_at_key(greenkey)
-        cell.counter = -1
         old_token = cell.get_entry_loop_token()
         cell.set_entry_loop_token(entry_loop_token)
+        cell.counter = -1       # valid entry bridge attached
         if old_token is not None:
             self.cpu.redirect_call_assembler(old_token, entry_loop_token)
             # entry_loop_token is also kept alive by any loop that used
@@ -574,6 +574,8 @@
             entry_loop_token = cell.get_entry_loop_token()
             if entry_loop_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)



More information about the Pypy-commit mailing list