Contents

- PyPy Python interpreter options
  - Internal Options
- General translation options
  - Internal Options

# PyPy Python interpreter options

The following options can be used after `translate.py targetpypystandalone` or as options to `py.py`.

- –allworkingmodules: use as many working modules as possible
- –ext: Comma-separated list of third-party builtin modules
- –magic_tag: Tag to differentiate .pyc files for different Python interpreters
- –objspace-disable_call_speedhacks: make sure that all calls go through space.call_args
- –objspace-honor__builtins__: Honor the __builtins__ key of a module dictionary
- –objspace-lonepycfiles: Import pyc files with no matching py file
- –objspace-std-getattributeshortcut: track types that override __getattribute__
- –objspace-std-intshortcut: special case addition and subtraction of two integers in BINARY_ADD//BINARY_SUBTRACT and their inplace counterparts
- –objspace-std-methodcachesizeexp: 2 ** methodcachesizeexp is the size of the of the method cache
- –objspace-std-newshortcut: cache and shortcut calling __new__ from builtin types
- –objspace-std-optimized_list_getitem: special case the ‘list[integer]’ expressions
- –objspace-std-sharesmallstr: always reuse the prebuilt string objects (the empty string and potentially single-char strings)
- –objspace-std-withcelldict: use dictionaries that are optimized for being used as module dicts
- –objspace-std-withidentitydict: track types that override __hash__, __eq__ or __cmp__ and use a special dict strategy for those which do not
- –objspace-std-withliststrategies: enable optimized ways to store lists of primitives
- –objspace-std-withmapdict: make instances really small but slow without the JIT
- –objspace-std-withmethodcache: try to cache method lookups
- –objspace-std-withmethodcachecounter: try to cache methods and provide a counter in __pypy__. for testing purposes only.
- –objspace-std-withprebuiltchar: use prebuilt single-character string objects
- –objspace-std-withprebuiltint: prebuild commonly used int objects
- –objspace-std-withrangelist: enable special range list implementation that does not actually create the full list until the resulting list is mutated
- –objspace-std-withsmalllong: use a version of ‘long’ in a C long long
- –objspace-std-withspecialisedtuple: use specialised tuples
- –objspace-std-withstrbuf: use strings optimized for addition (ver 2)
- –objspace-std-withtproxy: support transparent proxies
- –prebuiltintfrom: lowest integer which is prebuilt
- –prebuiltintto: highest integer which is prebuilt
- –soabi: Tag to differentiate extension modules built for different Python interpreters
- –translationmodules: use only those modules that are needed to run translate.py on pypy
- –withmod-__builtin__: use module __builtin__
- –withmod-__pypy__: use module __pypy__
- –withmod-_ast: use module _ast
- –withmod-_cffi_backend: use module _cffi_backend
- –withmod-_codecs: use module _codecs
- –withmod-_collections: use module _collections
- –withmod-_continuation: use module _continuation
- –withmod-_csv: use module _csv
- –withmod-_demo: use module _demo
- –withmod-_hashlib: use module _hashlib
- –withmod-_io: use module _io
- –withmod-_locale: use module _locale
- –withmod-_lsprof: use module _lsprof
- –withmod-_md5: use module _md5
- –withmod-_minimal_curses: use module _minimal_curses
- –withmod-_multibytecodec: use module _multibytecodec
- –withmod-_multiprocessing: use module _multiprocessing
- –withmod-_pypyjson: use module _pypyjson
- –withmod-_random: use module _random
- –withmod-_rawffi: use module _rawffi
- –withmod-_sha: use module _sha
- –withmod-_socket: use module _socket
- –withmod-_sre: use module _sre
- –withmod-_ssl: use module _ssl
- –withmod-_testing: use module _testing
- –withmod-_vmprof: use module _vmprof
- –withmod-_warnings: use module _warnings
- –withmod-_weakref: use module _weakref
- –withmod-_winreg: use module _winreg
- –withmod-array: use module array
- –withmod-binascii: use module binascii
- –withmod-bz2: use module bz2
- –withmod-cStringIO: use module cStringIO
- –withmod-cmath: use module cmath
- –withmod-cppyy: use module cppyy
- –withmod-cpyext: use module cpyext
- –withmod-crypt: use module crypt
- –withmod-errno: use module errno
- –withmod-exceptions: use module exceptions
- –withmod-fcntl: use module fcntl
- –withmod-gc: use module gc
- –withmod-imp: use module imp
- –withmod-itertools: use module itertools
- –withmod-marshal: use module marshal
- –withmod-math: use module math
- –withmod-micronumpy: use module micronumpy
- –withmod-mmap: use module mmap
- –withmod-operator: use module operator
- –withmod-parser: use module parser
- –withmod-posix: use module posix
- –withmod-pwd: use module pwd
- –withmod-pyexpat: use module pyexpat
- –withmod-pypyjit: use module pypyjit
- –withmod-select: use module select
- –withmod-signal: use module signal
- –withmod-struct: use module struct
- –withmod-symbol: use module symbol
- –withmod-sys: use module sys
- –withmod-termios: use module termios
- –withmod-thread: use module thread
- –withmod-time: use module time
- –withmod-token: use module token
- –withmod-unicodedata: use module unicodedata
- –withmod-zipimport: use module zipimport
- –withmod-zlib: use module zlib

## Internal Options

- –withmod-_file: use module _file
- –withmod-_pickle_support: use module _pickle_support

# General translation options

The following are options of `translate.py`. They must be given before the `targetxxx` on the command line.

- –opt -O: set the optimization level [0, 1, size, mem, 2, 3]

- -b –backend: Backend to use for code generation
- –cc: Specify compiler to use for compiling generated C
- –clever-malloc-removal: Drives inlining to remove mallocs in a clever way
- –clever-malloc-removal-threshold: Threshold when to inline functions in clever malloc removal
- –continuation: enable single-shot continuations
- –dont-write-c-files: Make the C backend write everyting to /dev/null. Useful for benchmarking, so you don’t actually involve the disk
- –dump_static_data_info: Dump static data info
- –entrypoints: Comma separated list of keys choosing secondary entrypoints
- –fork-before: (UNIX) Create restartable checkpoint before step
- –gc: Garbage Collection Strategy
- –gcremovetypeptr: Remove the typeptr from every object
- –gcrootfinder: Strategy for finding GC Roots (framework GCs only)
- –if-block-merge: Merge if ... elif chains
- –inline-threshold: Threshold when to inline functions
- –jit-backend: choose the backend for the JIT
- –listcompr: When true, look for and special-case the sequence of operations that results from a list comprehension and attempt to pre-allocate the list
- –lldebug: If true, makes an lldebug build
- –lldebug0: If true, makes an lldebug0 build
- –log: Include debug prints in the translation (PYPYLOG=...)
- –make-jobs: Specify -j argument to make for compilation (C backend only)
- –no-profopt: Don’t use profile based optimization
- –no__thread: don’t use __thread for implementing TLS
- –output: Output file name
- –platform: target platform
- –profopt: Specify profile based optimization script
- –sandbox: Produce a fully-sandboxed executable
- –shared: Build as a shared library
- –thread: enable use of threading primitives
- –translation-backendopt-constfold: Constant propagation
- –translation-backendopt-inline: Do basic inlining and malloc removal
- –translation-backendopt-mallocs: Remove mallocs
- –translation-backendopt-none: Do not run any backend optimizations
- –translation-backendopt-print_statistics: Print statistics while optimizing
- –translation-backendopt-profile_based_inline: Use call count profiling to drive inlining, specify arguments
- –translation-backendopt-profile_based_inline_threshold: Threshold when to inline functions for profile based inlining
- –translation-backendopt-really_remove_asserts: Really remove operations that look like ‘raise AssertionError’, without relying on the C compiler
- –translation-backendopt-remove_asserts: Remove operations that look like ‘raise AssertionError’, which lets the C optimizer remove the asserts
- –translation-backendopt-stack_optimization: Tranform graphs in SSI form into graphs tailored for stack based virtual machines (only for backends that support it)
- –translation-backendopt-storesink: Perform store sinking
- –translation-icon: Path to the (Windows) icon to use for the executable
- –translation-jit: generate a JIT
- –translation-jit_opencoder_model: the model limits the maximal length of traces. Use big if you want to go bigger than the default
- –translation-jit_profiler: integrate profiler support into the JIT
- –translation-libname: Windows: name and possibly location of the lib file to create
- –translation-rweakref: The backend supports RPython-level weakrefs
- –translation-taggedpointers: When true, enable the use of tagged pointers. If false, use normal boxing
- –translation-withsmallfuncsets: Represent groups of less funtions than this as indices into an array
- –verbose: Print extra information

## Internal Options

- –clever-malloc-removal-heuristic: Dotted name of an heuristic function for inlining in clever malloc removal
- –inline-heuristic: Dotted name of an heuristic function for inlining
- –raisingop2direct_call: Transform operations that can implicitly raise an exception into calls to functions that explicitly raise exceptions
- –translation-backendopt-profile_based_inline_heuristic: Dotted name of an heuristic function for profile based inlining