The default compiler
On every native platform, the top-level v executable contains the default
compiler whose source lives in vlib/v. Every direct C build, including compiler
self-builds, is compiled in-process. The CLI remains in cmd/v; test is
handled by the default compiler, and external tools are compiled with it first.
External tools are cached under the user's V cache directory. Rebuilding a tool prunes stale builds while retaining fresh builds for other flags and checkouts. Pruning accepts only regular metadata files opened without following symbolic links. On Unix, it also checks ownership before reading another cache entry.
Cached C builds preserve dependencies of reused modules and regenerate declarations
and literals needed by changed program code, including fixed-array map keys.
Warm v run builds retain shared and newly introduced string literals without
duplicate C definitions.
Programs using runtime v.reflection reparse original declarations to preserve
source-file metadata while reusing eligible cached objects.
Retries that reparse cached module sources preserve caller values for V3_CACHE_FORCE_SOURCE
at compile time and when running the program.
The experimental unchanged-build receipt cache is disabled by default. Set
V3_ENABLE_UNCHANGED_BUILD_CACHE=1 to opt in; -nocache and
V3_DISABLE_UNCHANGED_BUILD_CACHE=1 disable it. Its early executable restore does
not yet track all compile-time environment, module-search, or native linker inputs.
Keep it disabled when those inputs can change between builds.
Parallel monomorphization also remains opt-in through V3_PARALLEL_MONOMORPHIZE=1
while nested generic-interface dispatch is being validated.
The standard bootstrap does not build the sibling v1_fallback executable
(v1_fallback.exe on Windows). When V needs the compatibility compiler and the
sibling is missing, it reports that it is running make v1. That target reuses
or downloads the complete 0.5.2 release under the user cache. If no release
binary can run, oldv clones the 0.5.2 V sources and matching vc snapshot and
builds the fallback there. You can run make v1 explicitly to prepare it ahead
of time. Automatic provisioning keeps its launcher metadata in the user cache,
so an older read-only sibling installation can remain untouched. -old-compiler
launches the fallback explicitly, and ordinary user builds and external tools
retry through it after a compiler or C compilation failure. Explicit
-new-compiler builds remain strict default-compiler operations.
-new-compiler remains accepted for command-line compatibility and otherwise
selects the same embedded driver.
oldv --command runs a shell command in the checked-out repository, using sh -c
on Unix and cmd /c on Windows. Commands can use shell operators such as &&,
pipes, and redirection; oldv returns the command's exit status.
The installer supplements the cached fallback vlib with modules whose public
paths moved after 0.5.2. Fallback roots missing these compatibility modules are
not used. The fallback identity check also rejects a current launcher copied into the
fallback slot, including older launchers that report the same compiler version, so
compatibility commands cannot recursively launch it.
If a fallback command exits unsuccessfully, V notes where the default
compiler stopped and how to show its suppressed diagnostics. For a command
that may have run user code, the note preserves the child's status without
mislabeling it as a compiler failure, including JavaScript tests run by the compatibility compiler.
Re-run the command with -new-compiler
to see the default-compiler diagnostics without a fallback retry.