[pypy-commit] pypy jit-targets: Dont rgc.collect() more than we have too (not working when run in a separate process by test_all)

hakanardo noreply at buildbot.pypy.org
Mon Dec 5 22:11:40 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-targets
Changeset: r50182:417d2384375b
Date: 2011-12-05 22:10 +0100
http://bitbucket.org/pypy/pypy/changeset/417d2384375b/

Log:	Dont rgc.collect() more than we have too (not working when run in a
	separate process by test_all)

diff --git a/pypy/jit/metainterp/test/test_memmgr.py b/pypy/jit/metainterp/test/test_memmgr.py
--- a/pypy/jit/metainterp/test/test_memmgr.py
+++ b/pypy/jit/metainterp/test/test_memmgr.py
@@ -15,6 +15,8 @@
 from pypy.jit.metainterp.test.support import LLJitMixin
 from pypy.rlib.jit import JitDriver, dont_look_inside
 from pypy.jit.metainterp.warmspot import get_stats
+from pypy.jit.metainterp.warmstate import JitCell
+from pypy.rlib import rgc
 
 class FakeLoopToken:
     generation = 0
@@ -81,6 +83,20 @@
     # See comments in TestMemoryManager.  To get temporarily the normal
     # behavior just rename this class to TestIntegration.
 
+    # We need an extra rgc.collect in get_procedure_token() for some of
+    # these tests to pass. But we dont want it there always since that will
+    # make all other tests take forever.
+    def setup_class(cls):
+        original_get_procedure_token = JitCell.get_procedure_token
+        def get_procedure_token(self):
+            rgc.collect();
+            return original_get_procedure_token(self)
+        JitCell.get_procedure_token = get_procedure_token
+        cls.original_get_procedure_token = original_get_procedure_token
+
+    def teardown_class(cls):
+        JitCell.get_procedure_token = cls.original_get_procedure_token
+
     def test_loop_kept_alive(self):
         myjitdriver = JitDriver(greens=[], reds=['n'])
         def g():
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
@@ -173,9 +173,6 @@
     wref_procedure_token = None
 
     def get_procedure_token(self):
-        if not we_are_translated():
-            from pypy.rlib import rgc
-            rgc.collect();
         if self.wref_procedure_token is not None:
             token = self.wref_procedure_token()
             if token and not token.invalidated:


More information about the pypy-commit mailing list