Skip to main content

Module module

Module module 

Source
Expand description

The load module (.iwm) of docs/load-module.md: its container, encoding rules and codec, and the modules a run loads programs from.

Modules§

codec
The codec traits, the writer and reader they use, the §4.1 and §4.4 impls, and the §4.6 macros.
crc
CRC-32: the IEEE polynomial, reflected, initial and final XOR 0xFFFFFFFF (load-module.md §3.3).
leb
Unsigned LEB128 and zigzag (load-module.md §4.1), with only the canonical form accepted.

Structs§

DirectoryEntry
A program’s line in the DIRECTORY section (load-module.md §6).
LirRecord
One program’s record in the LIR section: the fields of Program no other section holds.
LoadedModule
The programs of a module, in ordinal order, with their directory, the mapsets they use, and for each program the file each source of its debug table names, None where the compiler supplied the member or no file was recorded.
Module
A module whose header and table are checked; a section’s checksum is checked when it is read.
ModuleWriter
Builds section bodies in id order; finish puts the string table first and adds the checksums.
Modules
Reader
A bounds-checked cursor over one section’s bytes.
Section
A section this version knows (load-module.md §3.4). Every one is required.
SectionEntry
SourceFile
A file the compile read, as the run journal of a run of its source names it (load-module.md §9.2): the library it was found in, 0 the source’s own directory and then each -I in order, its path from there, and its SHA-256 and length.
StringTable
The one table of strings a module’s sections refer to by index (load-module.md §4.2).
Version
Writer
Section bytes being built, and the string table they intern into.

Enums§

ModuleError

Constants§

EXTENSIONS
The first id of the extension sections, which are always written optional.
MAGIC
OPTIONAL
Flag bit 0 of a section entry: a reader that does not know the section skips it.

Traits§

Decode
Encode

Functions§

member_name
Whether name can name a library member; any other name never reaches the filesystem.
read
Reads and checks a module; the bytes of every section are checksummed.
write
A module of programs, each a top-level program in the directory, with no mapsets and no files recorded. Same input, same bytes.
write_module
The module module describes, refused (as the reader would) if its directory, mapsets, a program or a program’s files are invalid.
write_with
A module with the caller’s directory and mapsets and no files recorded, refused (as the reader would) if either, or a program, is invalid.

Type Aliases§

Check
What a program from a module must pass before the VM runs it, since a module is untrusted input.
LayoutRecord
One program’s record in the LAYOUT section.