class Savi::Compiler::CodeGen::VeronaRT

Defined in:

savi/compiler/code_gen/veronart.cr

Constant Summary

COWN_PAD_SIZE = 8 * ((USE_SYSTEMATIC_TESTING ? 12 : 8) - 1)
DESC_FINAL_FN = 3
DESC_ID = 0
DESC_NOTIFY_FN = 4
DESC_TRACE_FN = 1
DESC_TRACE_POSSIBLY_ISO_FN = 2
OBJECT_PAD_SIZE = 8 * (3 - 1)

The size by which every Cown object is padded with runtime-internal data. We cheat the size smaller by point pointer here because we know the first pointer is the type descriptor, which we still try not to touch directly, except in cases where we are mimicking with non-runtime-allocated objects.

USE_SYSTEMATIC_TESTING = true

Set to true only for debugging CodeGen of programs; otherwise, false.

TODO Should this be configurable by a flag at runtime?

Constructors

Instance Method Summary

Constructor Detail

def self.new(llvm : LLVM::Context, target_machine : LLVM::TargetMachine) #

[View source]

Instance Method Detail

def cast_kind_of(g : CodeGen, type_ref : Reach::Ref, llvm_type : LLVM::Type | Nil, pos : Source::Pos) : Symbol #

When an assignment cast may need to happen, classify the kind of type.


[View source]
def desc : LLVM::Type #

[View source]
def di_runtime_member_info(debug : DebugInfo) #

[View source]
def gen_action_desc(g : CodeGen, gtype : GenType, gfunc : GenFunc, action_type) #

[View source]
def gen_action_func(g : CodeGen, gtype : GenType, gfunc : GenFunc, action_type) #

[View source]
def gen_action_type(g : CodeGen, gtype : GenType, gfunc : GenFunc, params_types) #

[View source]
def gen_actor_acquire_into_scope(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_actor_release_from_scope(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_alloc(g : CodeGen, gtype : GenType, from_expr : AST::Node, name : String) #

This generates the code that allocates an object of the given type. This is the first step before actually calling the constructor of it.


[View source]
def gen_alloc_action(g : CodeGen, action_desc, name) #

[View source]
def gen_alloc_actor(g : CodeGen, gtype : GenType, name) #

[View source]
def gen_alloc_ctx_get(g : CodeGen) #

[View source]
def gen_alloc_object(g : CodeGen, gtype : GenType, name) #

[View source]
def gen_alloc_object_iso(g : CodeGen, gtype : GenType, name) #

[View source]
def gen_alloc_struct(g : CodeGen, llvm_type : LLVM::Type, name) #

[View source]
def gen_cast_value(g : CodeGen, value : LLVM::Value, from_kind : Symbol, to_kind : Symbol, from_type : Reach::Ref, to_type : Reach::Ref, from_expr : AST::Node) : LLVM::Value #

When an assignment cast needs to happen, take the runtime-appropriate action needed to convert from one type kind to a different type kind.


[View source]
def gen_current_root_get(g : CodeGen) #

[View source]
def gen_current_root_set(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_current_root_thread_local(g : CodeGen) #

[View source]
def gen_desc(g : CodeGen, gtype : GenType) #

This defines a global constant for the type descriptor of a type, which is held as the first value in an object, used for identifying its type at runtime, as well as a host of other functions related to dealing with objects in the runtime, such as allocating them and tracing them.


[View source]
def gen_desc_basetype #

This defines the generic LLVM struct type for what a type descriptor holds. The type descriptor for each type uses a more specific version of this. The order and sizes here must exactly match what is expected by the runtime, and they should correlate to the constants above.


[View source]
def gen_desc_empty(g : CodeGen) #

[View source]
def gen_desc_fn_impls(g : CodeGen, gtype : GenType) #

[View source]
def gen_desc_init(g : CodeGen, gtype : GenType, vtable) #

This populates the descriptor for the given type with its initialized data.


[View source]
def gen_desc_type(g : CodeGen, type_def : Reach::Def, vtable_size : Int32) : LLVM::Type #

This defines a more specific struct type than the above function, tailored to the specific type definition and its virtual table size. The actual type descriptor value for the type is an instance of this.


[View source]
def gen_expr_post(g : CodeGen, expr : AST::Node, value : LLVM::Value) #

For every expression whose value is generated, hook into the value and maybe take an action based on the given lifetime info.


[View source]
def gen_get_desc(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_hacky_stubs(g) #

TODO Remove these when we can stop calling them from Savi programs.


[View source]
def gen_intrinsic_cpointer_alloc(g : CodeGen, params, llvm_type, elem_size_value) #

[View source]
def gen_intrinsic_cpointer_realloc(g : CodeGen, params, llvm_type, elem_size_value) #

[View source]
def gen_iso_freeze_region(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_iso_merge_into_current_region(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_main(g : CodeGen) #

[View source]
def gen_main_inner(g : CodeGen) #

[View source]
def gen_runtime_decls(g : CodeGen) #

[View source]
def gen_send_impl(g : CodeGen, gtype : GenType, gfunc : GenFunc) #

[View source]
def gen_struct_type(g : CodeGen, gtype : GenType) #

[View source]
def gen_trace_impl(g : CodeGen, gtype : GenType) #

[View source]
def gen_trace_possibly_iso_impl(g : CodeGen, gtype : GenType) #

[View source]
def gen_traits_gep_get(g, desc, name) #

[View source]
def gen_traits_get(g, desc, name) #

[View source]
def gen_type_name_get(g, desc, name) #

[View source]
def gen_val_acquire_into_scope(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_val_release_from_scope(g : CodeGen, value : LLVM::Value) #

[View source]
def gen_vtable_gep_get(g, desc, name) #

[View source]
def obj : LLVM::Type #

[View source]