Added Hash map marking
This commit is contained in:
parent
3e188553d6
commit
a5c5d122b2
8 changed files with 133 additions and 28 deletions
|
|
@ -3,13 +3,20 @@
|
|||
#include <list>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "chunk.hpp"
|
||||
#include "profiler.hpp"
|
||||
|
||||
<<<<<<< HEAD
|
||||
#define HEAP_SIZE 320//65536
|
||||
#define FREE_THRESH (uint) 0
|
||||
// #define HEAP_DEBUG
|
||||
=======
|
||||
#define HEAP_SIZE 2097152 //256 //65536 //2097152
|
||||
#define FREE_THRESH (uint) 100000 //1000
|
||||
#define DEBUG
|
||||
>>>>>>> 74e0282 (Added Hash map marking)
|
||||
|
||||
namespace GC
|
||||
{
|
||||
|
|
@ -52,14 +59,22 @@ namespace GC
|
|||
|
||||
char *const m_heap;
|
||||
size_t m_size {0};
|
||||
<<<<<<< HEAD
|
||||
char *m_heap_top {nullptr};
|
||||
=======
|
||||
size_t m_total_size {0};
|
||||
>>>>>>> 74e0282 (Added Hash map marking)
|
||||
// static Heap *m_instance {nullptr};
|
||||
uintptr_t *m_stack_top {nullptr};
|
||||
bool m_profiler_enable {false};
|
||||
|
||||
std::vector<Chunk *> m_allocated_chunks;
|
||||
std::vector<Chunk *> m_freed_chunks;
|
||||
<<<<<<< HEAD
|
||||
std::list<Chunk *> m_free_list;
|
||||
=======
|
||||
std::unordered_map<uintptr_t, Chunk*> m_chunk_table;
|
||||
>>>>>>> 74e0282 (Added Hash map marking)
|
||||
|
||||
static bool profiler_enabled();
|
||||
// static Chunk *get_at(std::vector<Chunk *> &list, size_t n);
|
||||
|
|
@ -69,6 +84,8 @@ namespace GC
|
|||
void free(Heap &heap);
|
||||
void free_overlap(Heap &heap);
|
||||
void mark(uintptr_t *start, const uintptr_t *end, std::vector<Chunk *> &worklist);
|
||||
void mark_hash(uintptr_t *start, const uintptr_t *end);
|
||||
void create_table();
|
||||
void print_line(Chunk *chunk);
|
||||
void print_worklist(std::vector<Chunk *> &list);
|
||||
void mark_step(uintptr_t start, uintptr_t end, std::vector<Chunk *> &worklist);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue