Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment variables

None of these are needed for normal use. They exist for CI, for pinning toolchains, and for measuring.

Builds and caches

VariableEffect
SSPUR_STRICT_NATIVE=1Same as --strict-native: a function that can’t be compiled natively is an error, not a warning and a fallback
SSPUR_CACHERoot of every cache, instead of ~/.cache/sspur: native objects (native/), check results (check), unchanged programs for sspur run (run/), packages (pkgs/) and deploy builds (deploy/)
SSPUR_LOG=jsonPrint each log line as a JSON object with the time, the level and the message
SSPUR_LOG_LEVELdebug, info, warn or error: drop log lines below that level (a line without a level prefix is info)
SSL_CERT_FILEA PEM file of certificates the HTTP client trusts instead of the system’s roots
HTTPS_PROXY, HTTP_PROXY, ALL_PROXY, NO_PROXYProxies for the HTTP client (lowercase forms too)
SSPUR_INDEXThe package index to read instead of sspur-packages on raw.githubusercontent.com: an HTTPS base URL, a git URL, or a directory with packages/
SSPUR_OFFLINE=1Never download: use the cached index and packages only
SSPUR_REGISTRY_REPOThe GitHub repository sspur publish and sspur yank open requests in (default sspurlang/sspur-packages)
SSPUR_GH, SSPUR_NO_GH=1The GitHub CLI sspur publish uses, or don’t use it and print the request link
SSPUR_REGISTRY_CHECKSA registry.ssp to run instead of the copy built into sspur publish
SSPUR_LIBCURLPath of libcurl, if the HTTP client doesn’t find it (macOS and Linux)
SSPUR_OPENSSLDirectory of OpenSSL 3’s libraries, if http.serve with TLS doesn’t find them
SSPUR_NO_CHECK_CACHESet to any value to skip the shared check cache, like check --no-cache
SSPUR_JOBSParallel C compiler jobs for native objects (default one per core, fewer when memory is short)
SSPUR_OPT=0Turn off the proven-rewrite optimizer
SSPUR_SMT=offDon’t use Z3 to remove runtime checks during native builds
SSPUR_SMT_TIMEOUTZ3 time limit per query in milliseconds (default 500)
SSPUR_FILL_MSTime hole filling may spend per hole in milliseconds, for check, fill and the MCP tools; --fill-ms still wins (defaults 400 for check, 600 in editors, 1000 for fill)
SSPUR_LTODefault for --lto: off, thin or full
CCThe C compiler for native code and export-c (default clang)
SSPUR_DEBUG=1Same as --debug: native code with debug info mapped to the .ssp lines, at -O0 (Debugging). Part of the cache key
SSPUR_CFLAGSExtra C compiler flags for native builds, part of the cache key. -fsanitize=address,undefined builds native code under the sanitizers; on macOS run with DYLD_INSERT_LIBRARIES set to clang’s libclang_rt.asan_osx_dynamic.dylib
SSPUR_PROFDATAThe llvm-profdata to use for --pgo
SSPUR_LLVM_CCThe clang for --backend llvm
SSPUR_Z3The z3 that sspur verify and native builds use (default z3 on PATH); off or 0 means none

Running programs

VariableEffect
SSPURSet by sspur run, sspur test and sspur debug to the path of the running sspur for the program and the processes it starts, unless it is already set, so a program can run the same compiler with env_var("SSPUR").or("sspur") instead of whichever is first on PATH. Set it yourself to choose another one
SSPUR_STACKStack the interpreter may use for nested calls, instead of stopping at 20,000 calls; past it a call traps with stack overflow in f. A number of bytes with K, M or G, at least 1M: 256M fits about 130,000 calls of a simple recursive function on macOS and Linux, fewer on Windows, whose frames are larger. An invalid value is a warning and the 20,000-call limit
SSPUR_THREADSThreads for automatic data parallelism in pure pipelines (default: the number of cores). 1 makes them sequential
SSPUR_GPU=0Run GPU kernels on the CPU even when Metal is available
SSPUR_GPU_TRACE=1Print a line per GPU kernel launch
SSPUR_GC_STATS=1Print memory statistics to stderr: each collection, and when a native program exits, how many blocks were freed at their last use and how many were left for the collector
SSPUR_MEMgc turns off freeing at last use (no drops compiled, nothing freed early; the 0.8.1 behavior). check poisons freed blocks instead of reusing them and stops on a double free, for finding memory bugs (ADR 0033)
SSPUR_GC_MIN_MB, SSPUR_GC_FACTORCollect after max(MIN MB, FACTOR x live) of allocation (defaults 256 and 4). Lower values trade speed for memory
SSPUR_GC_STRESSCollect every N bytes, for testing the collector
SSPUR_DB_POOLConnections per SQLite database, 1 to 64 (default 8; always 1 for a memory database)

Targets and tools

VariableEffect
SSPUR_BARE_CC, SSPUR_LLDThe clang and ld.lld for sspur build --target (Apple’s clang has no riscv64 backend)
SSPUR_GPU_CCThe clang for sspur gpu --emit spirv and --emit ptx
SSPUR_DIRThe codebase directory for sspur mcp, like --dir

Installing

VariableEffect
SSPUR_VERSIONThe release install.sh installs, such as 1.0.0 (default: the latest)
SSPUR_INSTALL_DIRWhere install.sh puts the binary (default ~/.local/bin)
SSPUR_SKIP_ATTESTATIONSet to skip the gh attestation verify check that install.sh makes when gh is installed and signed in; the checksum is still checked
SSPUR_DOWNLOAD_BASEA mirror with the release archives and SHA256SUMS for install.sh and install.ps1 to download from, instead of the GitHub release

Deployed services

sspur deploy plan writes these into each function’s configuration, and sspur deploy local sets them for the processes it starts; the generated bootstrap reads them.

VariableEffect
SSPUR_HANDLERThe handler this function runs
SSPUR_BACKFILLThe store a backfill function migrates, instead of a handler
SSPUR_TABLE_<Store>The DynamoDB table of the store Store, for each store the handler’s effect row grants

Working on SSPUR

These are for debugging the compiler and its tests, and print to stderr unless noted.

VariableEffect
SSPUR_BINThe sspur that tools/corpus_diff.py and tools/playground_test.mjs compare against
SSPUR_ELAB_DUMPPrint the elaborated program before it is checked again
SSPUR_LOWER_DEBUGPrint why the native lowering gave up on a function
SSPUR_SPLIT1 builds native code per definition, 0 as one unit (default: per definition except at -O3 without --debug)
SSPUR_SPLIT_DEBUGPrint how long each native build stage took
SSPUR_C_TARGET=windowsGenerate the Windows flavor of the native C on another OS
SSPUR_FUZZ_TRACEPrint each native call sspur fuzz makes
SSPUR_SYNTH_TRACEPrint what hole filling probed: tests, inputs and time
SSPUR_CRASH_ATAbort at the named crash point in the codebase store, to test that a crash leaves it consistent
SSPUR_PGO_GENSet by --pgo for its training run: the directory the instrumented build writes its profile to