def create_entry_point(space, w_dict): w_entry_point = space.getitem(w_dict, space.wrap('entry_point')) w_run_toplevel = space.getitem(w_dict, space.wrap('run_toplevel')) w_call_finish_gateway = space.wrap(gateway.interp2app(call_finish)) w_call_startup_gateway = space.wrap(gateway.interp2app(call_startup)) w_os = setup_nanos(space) withjit = space.config.objspace.usemodules.pypyjit def entry_point(argv): space.timer.start("Entrypoint") if withjit: from pypy.jit.backend.hlinfo import highleveljitinfo highleveljitinfo.sys_executable = argv[0] #debug("entry point starting") #for arg in argv: # debug(" argv -> " + arg) if len(argv) > 2 and argv[1] == '--heapsize': # Undocumented option, handled at interp-level. # It has silently no effect with some GCs. # It works in Boehm and in the semispace or generational GCs # (but see comments in semispace.py:set_max_heap_size()). # At the moment this option exists mainly to support sandboxing. from pypy.rlib import rgc rgc.set_max_heap_size(int(argv[2])) argv = argv[:1] + argv[3:] try: try: space.timer.start("space.startup") space.call_function(w_run_toplevel, w_call_startup_gateway) space.timer.stop("space.startup") w_executable = space.wrap(argv[0]) w_argv = space.newlist([space.wrap(s) for s in argv[1:]]) space.timer.start("w_entry_point") w_exitcode = space.call_function(w_entry_point, w_executable, w_argv, w_os) space.timer.stop("w_entry_point") exitcode = space.int_w(w_exitcode) # try to pull it all in ## from pypy.interpreter import main, interactive, error ## con = interactive.PyPyConsole(space) ## con.interact() except OperationError, e: debug("OperationError:") debug(" operror-type: " + e.w_type.getname(space)) debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space)))) return 1 finally: try: space.timer.start("space.finish") space.call_function(w_run_toplevel, w_call_finish_gateway) space.timer.stop("space.finish") except OperationError, e: debug("OperationError:") debug(" operror-type: " + e.w_type.getname(space)) debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space)))) return 1 space.timer.stop("Entrypoint") space.timer.dump() return exitcode
def create_entry_point(space, w_dict): w_entry_point = space.getitem(w_dict, space.wrap('entry_point')) w_run_toplevel = space.getitem(w_dict, space.wrap('run_toplevel')) w_call_finish_gateway = space.wrap(gateway.interp2app(call_finish)) w_call_startup_gateway = space.wrap(gateway.interp2app(call_startup)) w_os = setup_nanos(space) def entry_point(argv): space.timer.start("Entrypoint") #debug("entry point starting") #for arg in argv: # debug(" argv -> " + arg) if len(argv) > 2 and argv[1] == '--heapsize': # Undocumented option, handled at interp-level. # It has silently no effect with some GCs. # It works in Boehm and in the semispace or generational GCs # (but see comments in semispace.py:set_max_heap_size()). # At the moment this option exists mainly to support sandboxing. from pypy.rlib import rgc rgc.set_max_heap_size(int(argv[2])) argv = argv[:1] + argv[3:] try: try: space.timer.start("space.startup") space.call_function(w_run_toplevel, w_call_startup_gateway) space.timer.stop("space.startup") w_executable = space.wrap(argv[0]) w_argv = space.newlist([space.wrap(s) for s in argv[1:]]) space.timer.start("w_entry_point") w_exitcode = space.call_function(w_entry_point, w_executable, w_argv, w_os) space.timer.stop("w_entry_point") exitcode = space.int_w(w_exitcode) # try to pull it all in ## from pypy.interpreter import main, interactive, error ## con = interactive.PyPyConsole(space) ## con.interact() except OperationError, e: debug("OperationError:") debug(" operror-type: " + e.w_type.getname(space, '?')) debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space)))) return 1 finally: try: space.timer.start("space.finish") space.call_function(w_run_toplevel, w_call_finish_gateway) space.timer.stop("space.finish") except OperationError, e: debug("OperationError:") debug(" operror-type: " + e.w_type.getname(space, '?')) debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space)))) return 1 space.timer.stop("Entrypoint") space.timer.dump() return exitcode