Example #1
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)

        if NonConstant(False):
            # Hack to give os.open() the correct annotation
            os.open("foo", 1, 1)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        modtable = ModTable()
        modtable.enter_module(module_name)
        if json_ast is None:
            ast = expand_to_ast(module_name, modtable)
        else:
            ast = load_json_ast_rpython(json_ast, modtable)
        modtable.exit_module(module_name, ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown

            shutdown(env)
        return 0
Example #2
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        entry_flag = 'byte-expand' in names
        reader = JsonLoader(bytecode_expand=entry_flag)
        if json_ast is None:
            ast = reader.expand_to_ast(module_name)
        else:
            ast = reader.load_json_ast_rpython(module_name, json_ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            if config.get('save-callgraph', False):
                with open('callgraph.dot', 'w') as outfile:
                    env.callgraph.write_dot_file(outfile)
            shutdown(env)
        return 0
Example #3
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)
        jit.set_param(None, "max_unroll_loops", 15)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        entry_flag = 'byte-expand' in names
        reader = JsonLoader(bytecode_expand=entry_flag)
        if json_ast is None:
            ast = reader.expand_to_ast(module_name)
        else:
            ast = reader.load_json_ast_rpython(module_name, json_ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            for callback in POST_RUN_CALLBACKS:
                callback(config, env)
            shutdown(env)
        return 0
Example #4
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)
        jit.set_param(None, "max_unroll_loops", 10)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        entry_flag = 'byte-expand' in names
        reader = JsonLoader(bytecode_expand=entry_flag)
        if json_ast is None:
            ast = reader.expand_to_ast(module_name)
        else:
            ast = reader.load_json_ast_rpython(module_name, json_ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            for callback in POST_RUN_CALLBACKS:
                callback(config, env)
            shutdown(env)
        return 0
Example #5
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)
        modtable = ModTable()
        if json_ast is None:
            ast = expand_to_ast(module_name, modtable)
        else:
            ast = load_json_ast_rpython(json_ast, modtable)
        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            shutdown(env)
        return 0
Example #6
0
    def old_pycket_actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)
        jit.set_param(None, "max_unroll_loops", 15)

        config, names, args, retval = old_pycket_parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        from pycket.env import w_global_config
        from pycket.prims.general import make_stub_predicates_no_linklet
        w_global_config.set_linklet_mode_off()

        entry_flag = 'byte-expand' in names
        multi_mod_flag = 'multiple-modules' in names

        multi_mod_map = ModuleMap(json_ast) if multi_mod_flag else None

        reader = JsonLoader(bytecode_expand=entry_flag,
                            multiple_modules=multi_mod_flag,
                            module_mapper=multi_mod_map)

        if json_ast is None:
            ast = reader.expand_to_ast(module_name)
        else:
            ast = reader.load_json_ast_rpython(module_name, json_ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            for callback in POST_RUN_CALLBACKS:
                callback(config, env)
            shutdown(env)
        return 0
Example #7
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)
        modtable = ModTable()
        if json_ast is None:
            ast = expand_to_ast(module_name, modtable)
        else:
            ast = load_json_ast_rpython(json_ast, modtable)
        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            shutdown(env)
        return 0
Example #8
0
    def actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)

        if NonConstant(False):
            # Hack to give os.open() the correct annotation
            os.open('foo', 1, 1)

        config, names, args, retval = parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        modtable = ModTable()
        modtable.enter_module(module_name)
        if json_ast is None:
            ast = expand_to_ast(module_name, modtable)
        else:
            ast = load_json_ast_rpython(json_ast, modtable)
        modtable.exit_module(module_name, ast)

        env = ToplevelEnv(pycketconfig)
        env.globalconfig.load(ast)
        env.commandline_arguments = args_w
        env.module_env.add_module(module_name, ast)
        try:
            val = interpret_module(ast, env)
        finally:
            from pycket.prims.input_output import shutdown
            if config.get('save-callgraph', False):
                with open('callgraph.dot', 'w') as outfile:
                    env.callgraph.write_dot_file(outfile)
            shutdown(env)
        return 0
Example #9
0
            for linkl_json in names['json-linklets']:
                vvv = config['verbose']
                load_inst_linklet_json(linkl_json, pycketconfig, vvv)

        try:
            if not config['stop']:
                racket_entry(names, config, pycketconfig, current_cmd_args)
        except ExitException, e:
            pass
        finally:
            from pycket.prims.input_output import shutdown
            env = ToplevelEnv(pycketconfig)
            #env.commandline_arguments = current_cmd_args
            for callback in POST_RUN_CALLBACKS:
                callback(config, env)
            shutdown(env)
        return 0

    def old_pycket_actual_entry(argv):
        jit.set_param(None, "trace_limit", 1000000)
        jit.set_param(None, "threshold", 131)
        jit.set_param(None, "trace_eagerness", 50)
        jit.set_param(None, "max_unroll_loops", 15)

        config, names, args, retval = old_pycket_parse_args(argv)
        if retval != 0 or config is None:
            return retval
        args_w = [W_String.fromstr_utf8(arg) for arg in args]
        module_name, json_ast = ensure_json_ast(config, names)

        entry_flag = 'byte-expand' in names