api

ASTAllocator.ch

Declarations in ASTAllocator.ch

3 declarationscompiler_runtime

Declarations

Public only
CleanupEntry#
Publicstruct
struct CleanupEntry { var instance_ptr : *void var cleanup_fn : func(*void) : void }
ASTAllocatorState#
Publicstruct
struct ASTAllocatorState { var blocks : **void var block_count : size_t var block_capacity : size_t var cleanups : *CleanupEntry var cleanup_count : size_t var cleanup_capacity : size_t }
ASTAllocator#
Publicstruct
struct ASTAllocator { var state : *ASTAllocatorState }
make#
PublicfunctionConstructor
func make() : ASTAllocator
store_cleanup#
Publicfunction
func store_cleanup(self : &ASTAllocator, obj : *void, cleanup_fn : func(*void) : void) : void
Records a cleanup function to run over an allocated object during
allocate_with_cleanup#
Publicfunction
func allocate_with_cleanup(self : &ASTAllocator, obj_size : size_t, alignment : size_t, cleanup_fn : func(*void) : void) : *void
Allocates and also records a cleanup fn, so the object's destructor runs
deinit#
Publicfunction
func deinit(self : &ASTAllocator) : void
Frees every tracked allocation. Cleanup functions run first so
delete#
Publicfunction
func delete(self : &ASTAllocator) : void