class Savi::Compiler::CodeGen::PonyRT

Defined in:

savi/compiler/code_gen/ponyrt.cr

Constant Summary

ACTOR_PAD_SIZE = 264

From libponyrt/pony.h Padding for actor types.

56 bytes: initial header, not including the type descriptor 52/104 bytes: heap 48/88 bytes: gc 28/0 bytes: padding to 64 bytes, ignored XXX: USE_RUNTIMESTATS -> 392

DESC_CUSTOM_DESERIALISE_FN = 10
DESC_CUSTOM_SERIALISE_SPACE_FN = 9
DESC_DESERIALISE_FN = 8
DESC_DISPATCH_FN = 11
DESC_EVENT_NOTIFY = 13
DESC_FIELD_COUNT = 2
DESC_FIELD_OFFSET = 3
DESC_FINAL_FN = 12
DESC_ID = 0
DESC_INSTANCE = 4
DESC_SERIALISE_FN = 7
DESC_SERIALISE_TRACE_FN = 6
DESC_SIZE = 1
DESC_TRACE_FN = 5
DESC_TRAITS = 14
DESC_TYPE_NAME = 15
DESC_VTABLE = 16
HEAP_MAX = (1_u64 << HEAP_MAXBITS)
HEAP_MAXBITS = (POOL_ALIGN_BITS - 1)
HEAP_MIN = (1_u64 << HEAP_MINBITS)
HEAP_MINBITS = 5

From libponyrt/mem/heap.h

HEAP_SIZECLASSES = ((HEAP_MAXBITS - HEAP_MINBITS) + 1)
POOL_ALIGN_BITS = 10
POOL_MAX = (1 << POOL_MAX_BITS)
POOL_MAX_BITS = 20
POOL_MIN = (1 << POOL_MIN_BITS)
POOL_MIN_BITS = 5

From libponyrt/mem/pool.h

SIZECLASS_TABLE = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4]

From libponyrt/mem/heap.c

TRACE_IMMUTABLE = 1
TRACE_MUTABLE = 0

From libponyrt/pony.h

TRACE_OPAQUE = 2

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

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

[View source]

Class Method Detail

def self.clzl_64(x) #

[View source]
def self.heap_index(size) #

From libponyrt/mem/heap.c


[View source]
def self.pool_index(size) #

From libponyrt/mem/pool.c

TODO verify correctness of result compared to ponyc for various sizes


[View source]

Instance Method Detail

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

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

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

[View source]
def gen_alloc(g : CodeGen, gtype : GenType, from_expr : AST::Node | Nil, 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_actor(g : CodeGen, gtype : GenType, from_expr : AST::Node | Nil, name, become_now = false) #

This generates the special kind of allocation needed by actors, invoked by the above function when the type being allocated is an actor.


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

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

This generates more generic code for allocating a given LLVM struct type, without the assumption of it being initialized as a proper runtime object.


[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 #

[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_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_dispatch_impl(g : CodeGen, gtype : GenType) #

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

We don't hook into gen_expr post hook at all - simply return the value.


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

[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_main(g : CodeGen) #

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

[View source]
def gen_runtime_defaults_func(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(g : CodeGen, src : LLVM::Value, dst : LLVM::Value, src_type, dst_type) #

[View source]
def gen_trace_dynamic(g : CodeGen, dst, src_type, dst_type, after_block) #

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

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

[View source]
def gen_trace_known(g : CodeGen, dst, src_type, ponyrt_trace_kind) #

[View source]
def gen_trace_tuple(g : CodeGen, dst, src_type) #

[View source]
def gen_trace_unknown(g : CodeGen, dst, ponyrt_trace_kind) #

[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_vtable_gep_get(g, desc, name) #

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

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

[View source]