module
Rubellite::Spinel
Overview
Integration module for Matz's Spinel ahead-of-time Ruby compiler. Compiles Ruby code or raw C kernels into native machine code, built into a shared library, and called directly via pure C ABI function pointers with zero VM overhead.
Defined in:
rubellite/spinel.crrubellite/spinel/async.cr
rubellite/spinel/channel.cr
rubellite/spinel/dsl.cr
rubellite/spinel/transpiler.cr
rubellite/spinel/vector.cr
Class Method Summary
-
.available? : Bool
Checks if the Spinel compiler binary is available
-
.cache_dir : String
Returns the persistent cache directory for compiled Spinel libraries
-
.clear_cache! : Nil
Clears all cached Spinel shared libraries
-
.compile_c(c_source : String, name : String = "kernel", compiler_flags : String = "-O3") : Kernel
Compiles raw C code into a multi-function Kernel container
-
.compile_c_function(c_source : String, func_name : String, return_type_name : String = "Int64", compiler_flags : String = "-O3") : NativeFunction
Compiles a single C function directly returning a NativeFunction
-
.compile_fn(ruby_code : String, name : String, args : Tuple, returns : Class) : NativeFunction
Backwards-compatible compile_fn API accepting tuple types
-
.compile_ruby(ruby_source : String, name : String, param_types : Array(String) = [] of String, return_type : String = "Int64", compiler_flags : String = "-O3") : NativeFunction
Compiles a Ruby function with Spinel into a NativeFunction with string type descriptors
-
.compile_typed_function(ruby_source : String, func_name : String, param_types : Array(Type), return_type : Type, compiler_flags : String = "-O3") : NativeFunction
Compiles a typed Ruby function into a NativeFunction using Type enums
-
.find_compiler : String
Locates the system C compiler (gcc, clang, or cl)
Class Method Detail
Returns the persistent cache directory for compiled Spinel libraries
Compiles raw C code into a multi-function Kernel container
Compiles a single C function directly returning a NativeFunction
Backwards-compatible compile_fn API accepting tuple types
Compiles a Ruby function with Spinel into a NativeFunction with string type descriptors