Added Hash map marking
This commit is contained in:
parent
cdca49354a
commit
74e02826e6
8 changed files with 109 additions and 33 deletions
|
|
@ -5,12 +5,13 @@
|
|||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "chunk.hpp"
|
||||
#include "profiler.hpp"
|
||||
|
||||
#define HEAP_SIZE 2097152 //65536
|
||||
#define FREE_THRESH (uint) 100000
|
||||
#define HEAP_SIZE 2097152 //256 //65536 //2097152
|
||||
#define FREE_THRESH (uint) 100000 //1000
|
||||
#define DEBUG
|
||||
|
||||
namespace GC
|
||||
|
|
@ -47,12 +48,14 @@ namespace GC
|
|||
|
||||
char *const m_heap;
|
||||
size_t m_size {0};
|
||||
size_t m_total_size {0};
|
||||
// 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;
|
||||
std::unordered_map<uintptr_t, Chunk*> m_chunk_table;
|
||||
|
||||
static bool profiler_enabled();
|
||||
// static Chunk *get_at(std::vector<Chunk *> &list, size_t n);
|
||||
|
|
@ -62,6 +65,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