Testing table lookup for marking
This commit is contained in:
parent
5af9509a5f
commit
3399023e3e
1 changed files with 23 additions and 2 deletions
|
|
@ -234,6 +234,7 @@ namespace GC
|
||||||
// create_table();
|
// create_table();
|
||||||
// mark_hash(stack_bottom, stack_top);
|
// mark_hash(stack_bottom, stack_top);
|
||||||
|
|
||||||
|
create_table();
|
||||||
vector<uintptr_t *> roots;
|
vector<uintptr_t *> roots;
|
||||||
// cout << "\nb4 find_roots\n";
|
// cout << "\nb4 find_roots\n";
|
||||||
find_roots(stack_bottom, roots);
|
find_roots(stack_bottom, roots);
|
||||||
|
|
@ -315,7 +316,26 @@ namespace GC
|
||||||
|
|
||||||
void Heap::find_chunks(uintptr_t *stack_addr, std::queue<std::pair<uintptr_t, uintptr_t>> &chunk_spaces)
|
void Heap::find_chunks(uintptr_t *stack_addr, std::queue<std::pair<uintptr_t, uintptr_t>> &chunk_spaces)
|
||||||
{
|
{
|
||||||
auto iter = m_allocated_chunks.begin();
|
Heap &heap = Heap::the();
|
||||||
|
|
||||||
|
auto it = heap.m_chunk_table.find(*stack_addr);
|
||||||
|
if (it != heap.m_chunk_table.end())
|
||||||
|
{
|
||||||
|
auto chunk = it->second;
|
||||||
|
|
||||||
|
if (!chunk->m_marked)
|
||||||
|
{
|
||||||
|
auto c_start = reinterpret_cast<uintptr_t>(chunk->m_start);
|
||||||
|
auto c_size = reinterpret_cast<uintptr_t>(chunk->m_size);
|
||||||
|
auto c_end = reinterpret_cast<uintptr_t>(c_start + c_size);
|
||||||
|
|
||||||
|
chunk->m_marked = true;
|
||||||
|
chunk_spaces.push(std::make_pair(c_start, c_end));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* auto iter = m_allocated_chunks.begin();
|
||||||
auto end = m_allocated_chunks.end();
|
auto end = m_allocated_chunks.end();
|
||||||
|
|
||||||
while (iter != end)
|
while (iter != end)
|
||||||
|
|
@ -334,7 +354,8 @@ namespace GC
|
||||||
chunk->m_marked = true;
|
chunk->m_marked = true;
|
||||||
chunk_spaces.push(std::make_pair(c_start, c_end));
|
chunk_spaces.push(std::make_pair(c_start, c_end));
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Heap::create_table()
|
void Heap::create_table()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue