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.cr
rubellite/spinel/async.cr
rubellite/spinel/channel.cr
rubellite/spinel/dsl.cr
rubellite/spinel/transpiler.cr
rubellite/spinel/vector.cr

Class Method Summary

Class Method Detail

def self.available? : Bool #

Checks if the Spinel compiler binary is available


[View source]
def self.cache_dir : String #

Returns the persistent cache directory for compiled Spinel libraries


[View source]
def self.clear_cache! : Nil #

Clears all cached Spinel shared libraries


[View source]
def self.compile_c(c_source : String, name : String = "kernel", compiler_flags : String = "-O3") : Kernel #

Compiles raw C code into a multi-function Kernel container


[View source]
def self.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


[View source]
def self.compile_fn(ruby_code : String, name : String, args : Tuple, returns : Class) : NativeFunction #

Backwards-compatible compile_fn API accepting tuple types


[View source]
def self.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


[View source]
def self.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


[View source]
def self.find_compiler : String #

Locates the system C compiler (gcc, clang, or cl)


[View source]