[pypy-commit] pypy jit-short_from_state: dont retrace loops with more than 100 emitted guards

hakanardo noreply at buildbot.pypy.org
Sun Aug 14 21:55:27 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r46500:44931ec4af34
Date: 2011-08-14 21:58 +0200
http://bitbucket.org/pypy/pypy/changeset/44931ec4af34/

Log:	dont retrace loops with more than 100 emitted guards

diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -317,6 +317,7 @@
         self.opaque_pointers = {}
         self.newoperations = []
         self.emitting_dissabled = False
+        self.emitted_guards = 0        
         if loop is not None:
             self.call_pure_results = loop.call_pure_results
 
@@ -491,6 +492,7 @@
         self.metainterp_sd.profiler.count(jitprof.OPT_OPS)
         if op.is_guard():
             self.metainterp_sd.profiler.count(jitprof.OPT_GUARDS)
+            self.emitted_guards += 1 # FIXME: can we reuse above counter?
             op = self.store_final_boxes_in_guard(op)
         elif op.can_raise():
             self.exception_might_have_happened = True
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,6 +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
 
 # FIXME: Introduce some VirtualOptimizer super class instead
 
@@ -213,6 +214,8 @@
             loop.preamble.operations.append(jmp)
 
             loop.operations = self.optimizer.newoperations
+            if self.optimizer.emitted_guards > 100:
+                loop.preamble.token.retraced_count = sys.maxint
 
             if short:
                 assert short[-1].getopnum() == rop.JUMP


More information about the pypy-commit mailing list