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
137 138 139 140 141 |
# File 'lib/ffi/llvm_jit.rb', line 137 def attach_function(name, func, args, returns = nil, = nil) mname, cname, arg_types, ret_type, = convert_attach_function_params(name, func, args, returns, ) function_handle = find_function_handle(cname, arg_types) attach_function_handle(function_handle, mname, 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
145 146 147 148 149 150 151 152 153 |
# File 'lib/ffi/llvm_jit.rb', line 145 def attach_llvm_jit_function(name, func, args, returns = nil, = nil) # TODO: support LLVM call_conv; note that function_names must be patched for that # (they also forgot an underscore on Windows for cdecl) # https://en.wikipedia.org/wiki/Name_mangling#C # (see core_ffi.rb and https://llvm.org/doxygen/namespacellvm_1_1CallingConv.html) mname, cname, arg_types, ret_type, = convert_attach_function_params(name, func, args, returns, ) function_handle = find_function_handle(cname, arg_types) attach_function_handle(function_handle, mname, arg_types, ret_type, , jit_only: true) end |