libjit-sys 0.2.1

Just-In-Time Compilation in Rust using LibJIT bindings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'jit'

function = nil
JIT::Context.build do |context|
  signature = JIT::Type.create_signature(
      JIT::ABI::CDECL,
      JIT::Type::INT,       # returns an integer
      [ JIT::Type::INT ])   # and tages an integer as a parameter
  function = JIT::Function.compile(context, signature) do |f|
    value = f.get_param(0)
    f.insn_return(value)
  end
end

p function.apply(42) #=> 42