# jit_ffi is automatically turned on by withmod-_ffi (which is enabled by default) BoolOption( "jit_ffi", "optimize libffi calls", default=False, cmdline=None), # misc BoolOption("verbose", "Print extra information", default=False), BoolOption("debug", "Record extra annotation information", cmdline="-d --debug", default=True), BoolOption("insist", "Try hard to go on RTyping", default=False, cmdline="--insist"), StrOption("cc", "Specify compiler to use for compiling generated C", cmdline="--cc"), StrOption("profopt", "Specify profile based optimization script", cmdline="--profopt"), BoolOption("noprofopt", "Don't use profile based optimization", default=False, cmdline="--no-profopt", negation=False), BoolOption("instrument", "internal: turn instrumentation on", default=False, cmdline=None), BoolOption("countmallocs", "Count mallocs and frees",
BoolOption("countmallocs", "Count mallocs and frees", default=False, cmdline=None), BoolOption("sandbox", "Produce a fully-sandboxed executable", default=False, cmdline="--sandbox", requires=[("translation.thread", False)]), BoolOption("rweakref", "The backend supports RPython-level weakrefs", default=True), # misc StrOption("cc", "Specify compiler to use for compiling generated C", cmdline="--cc"), StrOption("profopt", "Specify profile based optimization script", cmdline="--profopt"), BoolOption("noprofopt", "Don't use profile based optimization", default=False, cmdline="--no-profopt", negation=False), BoolOption("instrument", "internal: turn instrumentation on", default=False, cmdline=None), ArbitraryOption("instrumentctl", "internal", default=None), StrOption("output", "Output file name", cmdline="--output"),
cmdline="-i"), BoolOption("completer", "use readline commandline completer", default=False, cmdline="-C"), BoolOption("optimize", "dummy optimization flag for compatibility with CPython", default=False, cmdline="-O"), BoolOption("no_site_import", "do not 'import site' on initialization", default=False, cmdline="-S"), StrOption( "runmodule", "library module to be run as a script (terminates option list)", default=None, cmdline="-m"), StrOption("runcommand", "program passed in as CMD (terminates option list)", default=None, cmdline="-c"), StrOption( "warn", "warning control (arg is action:message:category:module:lineno)", default=None, cmdline="-W"), ]) pypy_init = gateway.applevel(''' def pypy_init(import_site):
negation=False)) if not optional: result.append( BoolOption("no_%s" % name, "Don't " + doc, default=False, cmdline="--no-" + name, negation=False)) return result translate_optiondescr = OptionDescription( "translate", "XXX", [ StrOption( "targetspec", "XXX", default='targetpypystandalone', cmdline=None), ChoiceOption("opt", "optimization level", OPT_LEVELS, default=DEFAULT_OPT_LEVEL, cmdline="--opt -O"), BoolOption("profile", "cProfile (to debug the speed of the translation process)", default=False, cmdline="--profile"), BoolOption("pdb", "Always run pdb even if the translation succeeds", default=False, cmdline="--pdb"), BoolOption("batch", "Don't run interactive helpers",
cmdline="-i"), BoolOption("completer", "use readline commandline completer", default=False, cmdline="-C"), BoolOption("optimize", "dummy optimization flag for compatibility with CPython", default=False, cmdline="-O"), BoolOption("no_site_import", "do not 'import site' on initialization", default=False, cmdline="-S"), StrOption( "runmodule", "library module to be run as a script (terminates option list)", default=None, cmdline="-m"), StrOption("runcommand", "program passed in as CMD (terminates option list)", default=None, cmdline="-c"), ]) pypy_init = gateway.applevel(''' def pypy_init(import_site): if import_site: try: import site except: import sys
validator=get_module_validator(modname)) for modname in all_modules ]), BoolOption( "allworkingmodules", "use as many working modules as possible", # NB. defaults to True, but in py.py this is overridden by # a False suggestion because it takes a while to start up. # Actual module enabling only occurs if # enable_allworkingmodules() is called, and it depends # on the selected backend. default=True, cmdline="--allworkingmodules", negation=True), StrOption("extmodules", "Comma-separated list of third-party builtin modules", cmdline="--ext", default=None), BoolOption( "translationmodules", "use only those modules that are needed to run translate.py on pypy", default=False, cmdline="--translationmodules", suggests=[("objspace.allworkingmodules", False)]), BoolOption( "logbytecodes", "keep track of bytecode usage", default=False), BoolOption("usepycfiles", "Write and read pyc files when importing", default=True), BoolOption("lonepycfiles", "Import pyc files with no matching py file", default=False,
BoolOption("no_site_import", "do not 'import site' on initialization", default=False, cmdline="-S"), BoolOption( "runmodule", "library module to be run as a script (terminates option list)", default=False, cmdline="-m"), BoolOption("runcommand", "program passed in as CMD (terminates option list)", default=False, cmdline="-c"), StrOption( "warn", "warning control (arg is action:message:category:module:lineno)", default=None, cmdline="-W"), ]) pypy_init = gateway.applevel(''' def pypy_init(import_site): if import_site: try: import site except: import sys print >> sys.stderr, "import site\' failed" ''').interphook('pypy_init')
from pypy.translator.js.js import JS from pypy.tool.error import AnnotatorError, FlowingError, debug from pypy.rlib.nonconst import NonConstant from pypy.annotation.policy import AnnotatorPolicy from py.compat import optparse from pypy.config.config import OptionDescription, BoolOption, StrOption from pypy.config.config import Config, to_optparse import py import sys js_optiondescr = OptionDescription("jscompile", "", [ BoolOption("view", "View flow graphs", default=False, cmdline="--view"), BoolOption("use_pdb", "Use debugger", default=False, cmdline="--pdb"), StrOption("output", "File to save results (default output.js)", default="output.js", cmdline="--output")]) class FunctionNotFound(Exception): pass class BadSignature(Exception): pass class JsPolicy(AnnotatorPolicy): allow_someobjects = False def get_args(func_data): l = [] for i in xrange(func_data.func_code.co_argcount): l.append("NonConstant(%s)" % repr(func_data.func_defaults[i]))