[pypy-commit] pypy slim-down-resumedescr: Improve the logic to be exactly how it was before, but instead of storing

fijal noreply at buildbot.pypy.org
Thu Dec 25 20:34:02 CET 2014


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: slim-down-resumedescr
Changeset: r75114:49886da188a7
Date: 2014-12-25 21:32 +0200
http://bitbucket.org/pypy/pypy/changeset/49886da188a7/

Log:	Improve the logic to be exactly how it was before, but instead of
	storing wref on each descr, store wref on compiled_loop_token (which
	has to be referenced from descr anyway)

diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -63,11 +63,13 @@
     if metainterp_sd.warmrunnerdesc is not None:    # for tests
         assert original_jitcell_token.generation > 0     # has been registered with memmgr
     wref = weakref.ref(original_jitcell_token)
+    clt = original_jitcell_token.compiled_loop_token
+    clt.loop_token_wref = wref
     for op in loop.operations:
         descr = op.getdescr()
         # not sure what descr.index is about
         if isinstance(descr, ResumeDescr):
-            descr.rd_loop_token = original_jitcell_token   # stick it there
+            descr.rd_loop_token = clt   # stick it there
             #n = descr.index
             #if n >= 0:       # we also record the resumedescr number
             #    original_jitcell_token.compiled_loop_token.record_faildescr_index(n)
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2139,8 +2139,9 @@
         assert isinstance(key, compile.ResumeGuardDescr)
         # store the resumekey.wref_original_loop_token() on 'self' to make
         # sure that it stays alive as long as this MetaInterp
-        # XXXX this is stored these days via rd_loop_token on resumedescr
-        self.resumekey_original_loop_token = key.rd_loop_token
+        self.resumekey_original_loop_token = key.rd_loop_token.loop_token_wref()
+        if self.resumekey_original_loop_token is None:
+            self.giveup() # should be rare
         self.staticdata.try_to_free_some_loops()
         self.initialize_state_from_guard_failure(key, deadframe)
         try:


More information about the pypy-commit mailing list