diff --git a/src/GC/include/cheap.h b/src/GC/include/cheap.h new file mode 100644 index 0000000..2db2b8d --- /dev/null +++ b/src/GC/include/cheap.h @@ -0,0 +1,22 @@ +#ifndef __CHEAP_H__ +#define __CHEAP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +struct cheap; +typedef struct cheap cheap_t; + +cheap_t *cheap_the(); +void cheap_init(); +void cheap_dispose(); +void *cheap_alloc(unsigned long size); +void cheap_set_profiler(bool mode); + +#ifdef __cplusplus +} +#endif + + +#endif /* __CHEAP_H__ */ \ No newline at end of file diff --git a/src/GC/lib/cheap.cpp b/src/GC/lib/cheap.cpp new file mode 100644 index 0000000..f9f7172 --- /dev/null +++ b/src/GC/lib/cheap.cpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include "heap.hpp" +#include "cheap.h" + +struct cheap { + void *obj; +}; + +cheap_t *cheap_the() { + cheap_t *c; + GC::Heap *heap; + + c = (cheap_t *)malloc(sizeof(*c)); + heap = &GC::Heap::the(); + c->obj = heap; + + return c; +} + +void cheap_init() { + GC::Heap::init(); +} \ No newline at end of file diff --git a/src/GC/lib/event.cpp b/src/GC/lib/event.cpp index 2815a77..185c613 100644 --- a/src/GC/lib/event.cpp +++ b/src/GC/lib/event.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +// #include +// #include +// #include #include "chunk.hpp" #include "event.hpp"