Contents

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

# PyPy Python interpreter options

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

- --allworkingmodules: use as many working modules as possible
- --ext: Comma-separated list of third-party builtin modules
- --hash: The hash function to use for strings: fnv from CPython 2.7 or siphash24 from CPython >= 3.4
- --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-disable_entrypoints: Disable external entry points, notably the cpyext module and cffi's embedding mode.
- --objspace-honor__builtins__: Honor the __builtins__ key of a module dictionary
- --objspace-lonepycfiles: Import pyc files with no matching py file
- --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-withliststrategies: enable optimized ways to store lists of primitives
- --objspace-std-withmethodcachecounter: try to cache methods and provide a counter in __pypy__. for testing purposes only.
- --objspace-std-withprebuiltint: prebuild commonly used int objects
- --objspace-std-withsmalllong: use a version of 'long' in a C long long
- --objspace-std-withspecialisedtuple: use specialised tuples
- --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-_cppyy: use module _cppyy
- --withmod-_csv: use module _csv
- --withmod-_demo: use module _demo
- --withmod-_hashlib: use module _hashlib
- --withmod-_io: use module _io
- --withmod-_jitlog: use module _jitlog
- --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-cpyext: use module cpyext
- --withmod-crypt: use module crypt
- --withmod-errno: use module errno
- --withmod-exceptions: use module exceptions
- --withmod-faulthandler: use module faulthandler
- --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 `bin/rpython`. 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
- --keepgoing: Continue annotating when errors are encountered, and report them all at the end of the annotation phase
- --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=...)
- --lto: enable link time optimization
- --make-jobs: Specify -j argument to make for compilation (C backend only)
- --no__thread: don't use __thread for implementing TLS
- --output: Output file name
- --platform: target platform
- --profopt: Enable profile guided optimization. Defaults to enabling this for PyPy. For other training workloads, please specify them in profoptargs
- --profoptargs: Absolute path to the profile guided optimization training script + the necessary arguments of the 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
- --translation-backendopt-profile_based_inline_heuristic: Dotted name of an heuristic function for profile based inlining