[pypy-commit] pypy mapdict-interp: Tweaks. Introduce a hack to avoid calling maybe_compile_and_run()

arigo noreply at buildbot.pypy.org
Wed May 18 09:59:58 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: mapdict-interp
Changeset: r44270:794d04b66c68
Date: 2011-05-17 19:39 +0200
http://bitbucket.org/pypy/pypy/changeset/794d04b66c68/

Log:	Tweaks. Introduce a hack to avoid calling maybe_compile_and_run()
	too often. Tentative.

diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -420,7 +420,13 @@
         crash_in_jit._dont_inline_ = True
 
         if self.translator.rtyper.type_system.name == 'lltypesystem':
+            state._enter_jit_counter = 0
             def maybe_enter_jit(*args):
+                if we_are_translated():
+                    state._enter_jit_counter -= 11
+                    if state._enter_jit_counter >= 0:
+                        return
+                    state._enter_jit_counter += 124
                 try:
                     maybe_compile_and_run(*args)
                 except JitException:
diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -87,9 +87,9 @@
             # Python opcode.  Here, to better support JIT compilation of
             # small loops, we decrement it by a possibly smaller constant.
             # We get the maximum 100 when the (unoptimized) trace length
-            # is at least 3200 (a bit randomly).
+            # is at least 6400 (a bit randomly).
             trace_length = r_uint(current_trace_length())
-            decr_by = trace_length // 32
+            decr_by = trace_length // 64
             if decr_by < 1:
                 decr_by = 1
             elif decr_by > 100:    # also if current_trace_length() returned -1


More information about the pypy-commit mailing list