Debian Codegraph @

rpython/jit/tl/targettiny3hotpath.py

raw symbols SCIP
1 from __future__ import print_function
2
3 from rpython.jit.tl import tiny3_hotpath as tiny3
4 from rpython.jit.backend.hlinfo import highleveljitinfo
5 from rpython.rlib.jit import set_user_param
6
7 def help(err="Invalid command line arguments."):
8 print(err)
9 print(highleveljitinfo.sys_executable, end=" ")
10 print("[-j param=value,...]", end=" ")
11 print("'tiny3 program string' arg0 [arg1 [arg2 [...]]]")
12 return 1
13
14 def entry_point(args):
15 """Main entry point of the stand-alone executable:
16 takes a list of strings and returns the exit code.
17 """
18 # store args[0] in a place where the JIT log can find it (used by
19 # viewcode.py to know the executable whose symbols it should display)
20 highleveljitinfo.sys_executable = args.pop(0)
21 if len(args) < 1:
22 return help()
23 if args[0] == '-j':
24 if len(args) < 3:
25 return help()
26 try:
27 set_user_param(tiny3.tinyjitdriver, args[1])
28 except ValueError:
29 return help("Bad argument to -j.")
30 args = args[2:]
31 bytecode = [s for s in args[0].split(' ') if s != '']
32 real_args = []
33 for arg in args[1:]:
34 try:
35 real_args.append(tiny3.IntBox(int(arg)))
36 except ValueError:
37 real_args.append(tiny3.FloatBox(tiny3.myfloat(arg)))
38 res = tiny3.interpret(bytecode, real_args)
39 print(tiny3.repr(res))
40 return 0
41
42 def target(driver, args):
43 return entry_point, None
44
45 if __name__ == '__main__':
46 import sys
47 entry_point(sys.argv)