Yoinked over the garbage collector.
This commit is contained in:
parent
2aff7a7743
commit
85f31b129b
33 changed files with 2417 additions and 0 deletions
25
src/GC/include/chunk.hpp
Normal file
25
src/GC/include/chunk.hpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace GC
|
||||
{
|
||||
/**
|
||||
* The basic element of what can be stored on
|
||||
* the heap. A chunk contains a start address
|
||||
* on the actual heap, the size of memory that
|
||||
* is allocated at that address and if the
|
||||
* chunk is reachable (marked).
|
||||
*/
|
||||
struct Chunk
|
||||
{
|
||||
bool m_marked {false};
|
||||
uintptr_t *const m_start {nullptr};
|
||||
const size_t m_size {0};
|
||||
|
||||
Chunk(size_t size, uintptr_t *start) : m_start(start), m_size(size) {}
|
||||
Chunk(const Chunk *const c) : m_marked(c->m_marked), m_start(c->m_start), m_size(c->m_size) {}
|
||||
Chunk(const Chunk &c) : m_marked(c.m_marked), m_start(c.m_start), m_size(c.m_size) {}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue