Crate jit [] [src]

This crate wraps LibJIT in an idiomatic style. For example, here's a quick example which makes a multiply function using LibJIT:

extern crate jit;
#[no_link] #[macro_use]
extern crate jit_macros;
use jit::*;
fn main() {
    // make a new context to make functions on
    let mut ctx = Context::<()>::new();
    jit_func!(&mut ctx, func, fn(x: isize, y: isize) -> isize {
        func.insn_return(x * y);
    }, {
        assert_eq!(func(4, 5), 20);
        assert_eq!(func(-2, -4), 8);
    });
}

Modules

flags

Call flags to a function

kind

The integer representation of a type

typecs

Type constants

Structs

Block

Represents a single LibJIT block

CallFlags
CompiledFunction

A function which has already been compiled from an UncompiledFunction, so it can be called but not added to.

Context

Holds all of the functions you have built and compiled. There can be multiple, but normally there is only one.

Field

A single field of a struct

Fields

Iterates through all the fields of a struct

Func

A function

Instruction

Represents a single LibJIT instruction

InstructionIter
Label

A label in the code that can be branched to in instructions

Needed

An ELF dependency iterator

Params

Iterator through all the arguments a function takes

ReadElf

An ELF binary reader

ReadElfError

An error from trying to open the ELF, including the filename

TaggedType
Ty

An object that represents a native system type

Type

An owned object that represents a native system type.

TypeKind
UncompiledFunction

A function which has not been compiled yet, so it can have instructions added to it.

Val

Vals form the backbone of the storage system in LibJIT

WriteElf

An ELF binary reader

Enums

Abi

A platform's application binary interface

ReadElfErrorCode

An error from trying to open the ELF

Traits

Compile

A type that can be compiled into a LibJIT representation

Functions

get

Get the Rust type given as a type descriptor

init

Initialise the library and prepare for operations

supports_threads

Check if the JIT supports theads

supports_virtual_memory

Check if the JIT supports virtual memory

uses_interpreter

Check if the JIT is using a fallback interpreter

Type Definitions

CowType

A copy-on-write type

StaticType

A static type