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

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/meta-project.x

The project meta build.

Functions

FunctionSummary
Frontend.prepare_metaBuilds the helper that runs the project meta functions inputs reach, or finds it in the cache, and makes it the one their translation calls.

Frontend

Frontend.prepare_meta

void Frontend.prepare_meta(Frontend f, List inputs)

Builds the helper that runs the project meta functions inputs reach, or finds it in the cache, and makes it the one their translation calls. Inputs that reach none use no helper. A group or helper that does not build is reported at the first call that needs it.

Source: src/meta-project.x:81

Design notes

Before a translation starts, the bodied meta functions its inputs reach are compiled into one helper program linked against the runtime, which the translation then calls (src/meta-helper-client.x). They come from each project .xmacro file an input imports, directly, through an included header, or through a package, and from an input that defines its own until those move to .xmacro files. Meta code under the x2c root’s lib, src, and etc is the compiler’s own, linked into it.

Each input that reaches any gets a table of its own, parsed from the input itself so its imports see the declarations they are used with. Each table’s object keeps only its entry global, so copies of one import in several tables link together. The helper is cached under the x2c cache root, keyed by the SHA-256 of those sources, the compiler stamp, the C compiler’s identity, and the flags, and is built again when a file its build read, x2c source or C header, changes.