Skip to main content

jit_call

Macro jit_call 

Source
macro_rules! jit_call {
    ($bcx:expr, $ptr_ty:expr, $callee:expr $(; $($arg:expr),* $(,)?)?) => { ... };
}
Expand description

Emit a Cranelift call instruction, lowering each Rust argument via JitArg.

Each argument expression must implement JitArg. Already-lowered IR Values pass through unchanged; Rust constants (integers, floats, &'static str, raw pointers) are emitted as IR constants on the spot.

Returns the Inst produced by bcx.ins().call(...) so the caller can extract return values via bcx.inst_results(inst).

§Example

// map_v: Value from a function param; "foo": &'static str literal.
let call = jit_call!(&mut bcx, ptr_ty, local_callee; map_v, "foo");
let result = bcx.inst_results(call)[0];