Debian Codegraph @

rpython/jit/tl/jittest.py

raw symbols SCIP
1 """
2 This file is imported by rpython.translator.driver when running the
3 target --pyjittest. Feel free to hack it as needed; it is imported
4 only after the '---> Checkpoint' fork.
5 """
6 from __future__ import print_function
7
8 import os
9 from rpython import conftest
10 from rpython.rtyper.llinterp import LLInterpreter
11 from rpython.rtyper.annlowlevel import llstr
12 from rpython.jit.metainterp import warmspot
13 from rpython.tool import runsubprocess
14
15 os.environ['PYPY_DONT_RUN_SUBPROCESS'] = '1'
16 reload(runsubprocess)
17
18
19 #ARGS = ["--jit", "threshold=100000,trace_eagerness=100000",
20 # "-S", "/home/arigo/pypysrc/32compiled/z.py"]
21 ARGS = ["targettest_executable_name",
22 "-r", "13", "/home/arigo/git/pyrlang/test_beam/fact.beam",
23 "fact", "20000"]
24
25
26 def jittest(driver):
27 graph = driver.translator._graphof(driver.entry_point)
28 interp = LLInterpreter(driver.translator.rtyper)
29
30 get_policy = driver.extra.get('jitpolicy', None)
31 if get_policy is None:
32 from rpython.jit.codewriter.policy import JitPolicy
33 jitpolicy = JitPolicy()
34 else:
35 jitpolicy = get_policy(driver)
36
37 from rpython.jit.backend.llgraph.runner import LLGraphCPU
38 apply_jit(jitpolicy, interp, graph, LLGraphCPU)
39
40
41 def apply_jit(policy, interp, graph, CPUClass):
42 print('warmspot.jittify_and_run() started...')
43 if conftest.option is None:
44 class MyOpt:
45 pass
46 conftest.option = MyOpt()
47 conftest.option.view = False
48 conftest.option.viewloops = True # XXX doesn't seem to work
49 LIST = graph.getargs()[0].concretetype
50 lst = LIST.TO.ll_newlist(len(ARGS))
51 for i, arg in enumerate(ARGS):
52 lst.ll_setitem_fast(i, llstr(arg))
53 warmspot.jittify_and_run(interp, graph, [lst], policy=policy,
54 listops=True, CPUClass=CPUClass,
55 backendopt=True, inline=True)