Module: FFI::LLVMJIT::Library
- Includes:
- FFI::Library
- Defined in:
- lib/ffi/llvm_jit.rb,
ext/ffi_llvm_jit/ffi_llvm_jit.c
Overview
Extension to FFI::Library to support JIT compilation using LLVM
Instance Method Summary collapse
- #attach_function(name, func, args, returns = nil, options = nil) ⇒ Object
-
#attach_llvm_jit_function(name, func, args, returns = nil, options = nil) ⇒ Object
Same as
attach_function, but raises an exception if cannot create JIT function instead of falling back to the regular FFI function.
Instance Method Details
#attach_function(name, func, args, returns = nil, options = nil) ⇒ Object
Note:
Return type doesn’t match the original method, but it’s usually not used
101 102 103 104 105 106 |
# File 'lib/ffi/llvm_jit.rb', line 101 def attach_function(name, func, args, returns = nil, = nil) mname, cname, arg_types, ret_type, = convert_params(name, func, args, returns, ) return if attached_llvm_jit_function?(mname, cname, arg_types, ret_type, ) super(mname, cname, arg_types, ret_type, ) end |
#attach_llvm_jit_function(name, func, args, returns = nil, options = nil) ⇒ Object
Same as attach_function, but raises an exception if cannot create JIT function instead of falling back to the regular FFI function
110 111 112 113 114 115 |
# File 'lib/ffi/llvm_jit.rb', line 110 def attach_llvm_jit_function(name, func, args, returns = nil, = nil) mname, cname, arg_types, ret_type, = convert_params(name, func, args, returns, ) return if attached_llvm_jit_function?(mname, cname, arg_types, ret_type, ) raise NotImplementedError, "Cannot create JIT function #{name}" end |