Almost finished with 1st impl of GC
Co-authored-by: ValterMiari <ValterMiari@users.noreply.github.com>
This commit is contained in:
parent
f42ea42273
commit
7fd324a5b2
5 changed files with 48 additions and 123 deletions
28
src/GC/heap.cpp
Normal file
28
src/GC/heap.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
||||
#include "include/heap.hpp"
|
||||
|
||||
namespace GC {
|
||||
|
||||
size_t Heap::getSize() {
|
||||
return m_size;
|
||||
}
|
||||
|
||||
void *Heap::alloc(size_t size) {
|
||||
auto heap = Heap::the();
|
||||
assert(heap.getSize() + size <= HEAP_SIZE);
|
||||
|
||||
return m_heap + m_size;
|
||||
}
|
||||
|
||||
void Heap::collect() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue