Debian Codegraph @

rpython/jit/tl/targettiny2hotpath.py

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