Wrapper for GC finished, untested

This commit is contained in:
Victor Olin 2023-03-29 15:13:24 +02:00
parent ee53759ca5
commit 16aa1be309
4 changed files with 142 additions and 15 deletions

View file

@ -1,25 +1,43 @@
#pragma once
#include <stdlib.h>
#include "heap.hpp"
#include "cheap.h"
struct cheap {
struct cheap
{
void *obj;
};
cheap_t *cheap_the() {
cheap_t *cheap_the()
{
cheap_t *c;
GC::Heap *heap;
c = (cheap_t *)malloc(sizeof(*c));
c = static_cast<cheap_t *>(malloc(sizeof(cheap_t)));
heap = &GC::Heap::the();
c->obj = heap;
return c;
}
void cheap_init() {
void cheap_init()
{
GC::Heap::init();
}
void cheap_dispose()
{
GC::Heap::dispose();
}
void *cheap_alloc(unsigned long size)
{
return GC::Heap::alloc(size);
}
void cheap_set_profiler(cheap_t *cheap, bool mode)
{
GC::Heap *heap = static_cast<GC::Heap *>(cheap->obj);
heap->set_profiler(mode);
}