Documentation
¶
Overview ¶
Package bccache is the on-disk bytecode compile cache. Scripts compiled from files (RunFile, require, loadfile) store their emitted main chunk under the user cache directory, keyed by a hash of the source text, the interpreter version, and the serialization format — so a source edit, an interpreter upgrade, or a bytecode-layout change each miss cleanly and recompile. A hit skips the whole lex → parse → typecheck → fold → codegen pipeline. Semantics are unchanged: a chunk is only cached after a fully successful compile, so scripts with parse/type errors are never served from cache.
The cache is best-effort throughout: any I/O or decode problem silently falls back to a fresh compile (and overwrites the bad entry). Set LUASCRIPT_NOCACHE=1 to disable it entirely.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileCached ¶
func CompileCached(src string) (*bytecode.InstructionSet, error)
CompileCached compiles src as a normal-mode chunk, consulting the bytecode cache. It returns the runnable main chunk (nested functions are reachable through its Protos table). On a miss the freshly compiled chunk is stored best-effort before returning.
Only file-backed, normal-mode compiles should go through here: REPL chunks carry REPL-mode codegen differences and `load()` string chunks are dynamic one-offs that would only pollute the cache.
Types ¶
This section is empty.