Skip to main content

Module env

Module env 

Source
Expand description

The resolved AST, Rast, and its environment, Env: the declarations resolution builds and typing changes again (Channel, Struct and its Fields, Const, LocalVar), and build, which builds them from a checked AST. What typing leaves as resolved is base’s.

Env holds the system’s arenas, each program’s locals by its protection domain, and the foreign functions the programs call (ForeignFn, each once). It owns its data: names, spans and signatures are copied, so it outlives the AST and the store of loaded files it was built from.

build resolves every name (system.rs the .fis, program.rs each .fi), rejecting duplicates and validating the system as it goes (validation.rs), and lays out the vaddrs (vaddr.rs). A declaration’s id is its position in the AST: any error fails the build, so on success every declaration was built. A program’s id is its protection domain’s: build walks the PDs and takes each one’s .fi by name, so a PD without a program, a file naming no PD, and a second file for one PD are each an error.

Structs§

Channel
A channel between two protection domains.
Const
A system const.
Env
The environment: every declaration of a resolved project, each name a reference to the node it denotes.
Field
A struct field.
ForeignFn
A foreign function a program calls: its name, and its signature in fic’s types as written, lowered from its file’s language (ty::foreign::signature). The store says where it is (ForeignModules::function).
LocalVar
A local variable: the program’s, its PD’s state.
Rast
The resolved AST: the environment and the bodies.
Struct
A struct.

Functions§

build
Build the resolved AST of a project the front end has checked on env, which holds its data layer (build_data), over the store of the files its imports loaded, recording in it where each called function is (ffis).
build_data
Build the environment’s data layer, build’s first stage: the structs and consts resolved, each struct validated, in an environment with no system or program yet. Returns it and its warnings.
build_programs
Build the resolved AST on env, which holds the data layer and the system (build_system): each program resolved, then the buffers’ regions checked against the programs’ mappings. Its vaddrs are laid out after (lay_out).
build_system
Build the system on env, which holds the data layer (build_data): build’s second stage, its memory regions, protection domains and channels resolved and validated, the channels’ ids allocated. Returns it and its warnings.
lay_out
Lay out the vaddrs of rast‘s mappings, the system’s buffers and the programs’ own, once build_programs has them all: each pinned one checked, the rest allocated, none overlapping in its protection domain.

Type Aliases§

LocalVars
A program’s local variables, in source order.