Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
srn_mm_t Struct Reference

Main memory manager structure that will own all the allocated blocks and data. More...

#include <interface.h>

Collaboration diagram for srn_mm_t:
[legend]

Data Fields

srn_spinlock_t lock
 This spinlock is here to protect the srn_mm_t when allocating/deallocating new blocks.
 
srn_memory_provider_tprovider
 An abstraction over a memory provider like the malloc/free pair.
 
uint64_t block_bitmap [4]
 This is a 256bit bitmap we treat it as a whole.
 
size_t block_size
 
size_t block_count
 
srn_block_tblocks [MAX_NUMBER_OF_BLOCKS]
 
srn_block_timmortal_block
 Immortal block is a chain of blocks which will never die.
 

Detailed Description

Main memory manager structure that will own all the allocated blocks and data.

In every instance of the compiler there should be only one instance of this. It should be created via srn_mm_init and destroyed via srn_shutdown_memory_manager.

Definition at line 112 of file interface.h.

Field Documentation

◆ block_bitmap

uint64_t srn_mm_t::block_bitmap[4]

This is a 256bit bitmap we treat it as a whole.

1 means that bit position in the blocks array is occupied for allocation. otherwise it is free.

Definition at line 126 of file interface.h.

◆ block_count

size_t srn_mm_t::block_count

Definition at line 128 of file interface.h.

◆ block_size

size_t srn_mm_t::block_size

Definition at line 127 of file interface.h.

◆ blocks

srn_block_t* srn_mm_t::blocks[MAX_NUMBER_OF_BLOCKS]

Definition at line 129 of file interface.h.

◆ immortal_block

srn_block_t* srn_mm_t::immortal_block

Immortal block is a chain of blocks which will never die.

We will free the chain at exit. it is there to allocate objects that will be around for the duration of the program.

Definition at line 134 of file interface.h.

◆ lock

srn_spinlock_t srn_mm_t::lock

This spinlock is here to protect the srn_mm_t when allocating/deallocating new blocks.

It is NOT used to protect blocks themselves. For block level operations we use a block level spinlock

Definition at line 119 of file interface.h.

◆ provider

srn_memory_provider_t* srn_mm_t::provider

An abstraction over a memory provider like the malloc/free pair.

Definition at line 122 of file interface.h.


The documentation for this struct was generated from the following file: