Skip to main content

Crate nifty_codegen

Crate nifty_codegen 

Source
Expand description

Compiles checked Nifty programs to machine code with Cranelift, and links them against the nifty-rt runtime library into executables.

Modules§

compile 🔒
Compiles a checked program: its functions, its states’ starting values, and every dynamic part of its windows and views, then emits the nifty_rt::ProgramDesc that describes them to the runtime.
emit 🔒
Writing functions and data into a Cranelift module: an object file for nf build, or memory for code loaded in-process.
error 🔒
link 🔒
Links a compiled app’s object file with the Nifty runtime library into an executable, with the system’s own linker.
object 🔒
Object files for nf build: a compiled program and the main that runs it.

Structs§

Blob
The bytes of one piece of data, and the pointers in it, which the linker fills in.
CodegenError
Why an app couldn’t be compiled or linked.
Emitter
A module being written, with the contexts Cranelift reuses between functions.

Enums§

Target
What a pointer in data points at.

Constants§

RUNTIME_LIBRARY
The file name of the runtime library every compiled app links against, as nifty-rt builds it; nf is installed next to it.

Functions§

compile
Compiles program into emitter, and returns its nifty_rt::ProgramDesc. locate says where each span is, for the errors the app may report.
compile_app
Compiles program to an object file whose main runs it, with locate saying where each span is, for the errors the app may report.
finish
The object file’s bytes.
host_isa
The instruction set of the system nf runs on. Code loaded in-process must not be position-independent; executables on macOS and Windows must be, since they load at a random address.
link
Links object with runtime, the runtime library, into the executable executable, replacing it.
object_emitter
An empty object file for the system nf runs on, named name inside.