[pypy-commit] pypy jit-short_from_state: make this threshold tuneable

hakanardo noreply at buildbot.pypy.org
Mon Aug 15 10:22:29 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r46510:c137f92b5618
Date: 2011-08-15 10:25 +0200
http://bitbucket.org/pypy/pypy/changeset/c137f92b5618/

Log:	make this threshold tuneable

diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -9,7 +9,7 @@
 from pypy.jit.metainterp.resoperation import rop, ResOperation
 from pypy.jit.metainterp.resume import Snapshot
 from pypy.rlib.debug import debug_print
-import sys
+import sys, os
 
 # FIXME: Introduce some VirtualOptimizer super class instead
 
@@ -214,7 +214,12 @@
             loop.preamble.operations.append(jmp)
 
             loop.operations = self.optimizer.newoperations
-            if self.optimizer.emitted_guards > 100:
+            maxguards_str = os.environ.get('PYPY_MAX_RETRACE_GUARDS')
+            if maxguards_str:
+                maxguards = int(maxguards_str)
+            else:
+                maxguards = 100
+            if self.optimizer.emitted_guards > maxguards:
                 loop.preamble.token.retraced_count = sys.maxint
 
             if short:


More information about the pypy-commit mailing list