[pypy-svn] r59679 - pypy/branch/oo-jit/pypy/jit/tl
antocuni at codespeak.net
antocuni at codespeak.net
Mon Nov 3 15:08:11 CET 2008
Author: antocuni
Date: Mon Nov 3 15:08:11 2008
New Revision: 59679
Modified:
pypy/branch/oo-jit/pypy/jit/tl/targettlc.py
pypy/branch/oo-jit/pypy/jit/tl/tlc.py
Log:
whack at tlc.py and targettlc.py to generate an executable that contains both
a jitted and a non-jitted interpreter
Modified: pypy/branch/oo-jit/pypy/jit/tl/targettlc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/tl/targettlc.py (original)
+++ pypy/branch/oo-jit/pypy/jit/tl/targettlc.py Mon Nov 3 15:08:11 2008
@@ -1,6 +1,7 @@
+import time
import py
py.magic.autopath()
-from pypy.jit.tl.tlc import interp, interp_eval
+from pypy.jit.tl.tlc import interp, interp_eval, interp_nonjit
from pypy.jit.codegen.hlinfo import highleveljitinfo
@@ -10,15 +11,38 @@
"""
# store args[0] in a place where the JIT log can find it (used by
# viewcode.py to know the executable whose symbols it should display)
- highleveljitinfo.sys_executable = args[0]
- if len(args) < 3:
- print "Usage: %s filename x" % (args[0],)
+ exe = args[0]
+ args = args[1:]
+ highleveljitinfo.sys_executable = exe
+ if len(args) < 2:
+ print "Usage: %s [--onlyjit] filename x" % (exe,)
return 2
- filename = args[1]
- x = int(args[2])
+
+ onlyjit = False
+ if args[0] == '--onlyjit':
+ onlyjit = True
+ args = args[1:]
+
+ filename = args[0]
+ x = int(args[1])
bytecode = load_bytecode(filename)
+
+ if not onlyjit:
+ start = time.clock()
+ res = interp_nonjit(bytecode, inputarg=x)
+ stop = time.clock()
+ print 'Non jitted: %d (%f seconds)' % (res, stop-start)
+
+ start = time.clock()
res = interp(bytecode, inputarg=x)
- print res
+ stop = time.clock()
+ print 'Warmup jitted: %d (%f seconds)' % (res, stop-start)
+
+ start = time.clock()
+ res = interp(bytecode, inputarg=x)
+ stop = time.clock()
+ print 'Warmed jitted: %d (%f seconds)' % (res, stop-start)
+
return 0
def load_bytecode(filename):
Modified: pypy/branch/oo-jit/pypy/jit/tl/tlc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/tl/tlc.py (original)
+++ pypy/branch/oo-jit/pypy/jit/tl/tlc.py Mon Nov 3 15:08:11 2008
@@ -2,9 +2,9 @@
import autopath
import py
+from pypy.rlib.objectmodel import specialize
from pypy.jit.tl.tlopcode import *
from pypy.jit.tl import tlopcode
-from pypy.rlib.jit import hint
class Obj(object):
@@ -110,7 +110,16 @@
t = -(-ord(c) & 0xff)
return t
-def make_interp(supports_call):
+def make_interp(supports_call, jitted=True):
+ if jitted:
+ from pypy.rlib.jit import hint
+ else:
+ @specialize.argtype(0)
+ def hint(x, global_merge_point=False,
+ promote_class=False,
+ forget=False,
+ concrete=False):
+ return x
def interp(code='', pc=0, inputarg=0):
if not isinstance(code,str):
@@ -273,6 +282,7 @@
interp , interp_eval = make_interp(supports_call = True)
interp_without_call, interp_eval_without_call = make_interp(supports_call = False)
+interp_nonjit , interp_eval_nonjit = make_interp(supports_call = True, jitted=False)
if __name__ == '__main__':
import sys
More information about the Pypy-commit
mailing list