[pypy-commit] pypy optresult: fix pypyjit.py

fijal noreply at buildbot.pypy.org
Tue Jun 9 11:15:19 CEST 2015


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult
Changeset: r77983:649600014b9a
Date: 2015-06-09 11:15 +0200
http://bitbucket.org/pypy/pypy/changeset/649600014b9a/

Log:	fix pypyjit.py

diff --git a/pypy/tool/pypyjit.py b/pypy/tool/pypyjit.py
--- a/pypy/tool/pypyjit.py
+++ b/pypy/tool/pypyjit.py
@@ -14,6 +14,9 @@
     print >> sys.stderr, __doc__
     sys.exit(2)
 
+import sys
+sys.setrecursionlimit(100000000)
+
 from pypy.objspace.std import Space
 from rpython.config.translationoption import set_opt_level
 from pypy.config.pypyoption import get_pypy_config, set_pypy_opt_level
@@ -22,6 +25,7 @@
 from rpython.rtyper.lltypesystem import lltype
 from pypy.interpreter.pycode import PyCode
 from rpython.translator.goal import unixcheckpoint
+import pypy.module.pypyjit.interp_jit
 
 config = get_pypy_config(translating=True)
 config.translation.backendopt.inline_threshold = 0.1
@@ -33,6 +37,8 @@
 config.objspace.usemodules.pypyjit = True
 config.objspace.usemodules.array = False
 config.objspace.usemodules._weakref = False
+config.objspace.usemodules.struct = True
+config.objspace.usemodules.time = True
 config.objspace.usemodules._sre = False
 config.objspace.usemodules._lsprof = False
 #
@@ -73,6 +79,7 @@
 read_code_ptr = llhelper(FPTR, read_code)
 
 def entry_point():
+    space.startup()
     from pypy.module.marshal.interp_marshal import loads
     code = loads(space, space.wrap(hlstr(read_code_ptr())))
     assert isinstance(code, PyCode)
diff --git a/pypy/tool/pypyjit_demo.py b/pypy/tool/pypyjit_demo.py
--- a/pypy/tool/pypyjit_demo.py
+++ b/pypy/tool/pypyjit_demo.py
@@ -1,8 +1,31 @@
-def f():
-    i = 0
-    while i < 1303:
-        i += 1
-    return i
 
+import time
+l = []
 
-f()
+for i in range(100):
+    print i
+    t0 = time.time()
+    exec """
+def k(a, b, c):
+    pass
+
+def g(a, b, c):
+    k(a, b + 1, c + 2)
+    k(a, b + 1, c + 2)
+    k(a, b + 1, c + 2)
+    k(a, b + 1, c + 2)
+    k(a, b + 1, c + 2)
+
+def f(i):
+    g(i, i + 1, i + 2)
+    g(i, i + 1, i + 2)
+    g(i, i + 1, i + 2)
+    g(i, i + 1, i + 2)
+    g(i, i + 1, i + 2)
+    g(i, i + 1, i + 2)
+for i in range(1000):
+    f(i)
+"""
+    l.append(time.time() - t0)
+
+print l


More information about the pypy-commit mailing list