LibJS: Make Heap own its own StackInfo instance

While this does mean that we keep one copy of the stack info in the VM,
and another in the Heap; keeping a separate instance removes one more
instance of coupling between the heap and LibJS specific details.
This commit is contained in:
Shannon Booth 2024-08-18 22:04:55 +12:00 committed by Andreas Kling
parent d199bf60cf
commit eef9a53eec
Notes: github-actions[bot] 2024-11-13 10:09:30 +00:00
2 changed files with 3 additions and 2 deletions

View file

@ -317,9 +317,8 @@ NO_SANITIZE_ADDRESS void Heap::gather_conservative_roots(HashMap<Cell*, HeapRoot
add_possible_value(possible_pointers, raw_jmp_buf[i], HeapRoot { .type = HeapRoot::Type::RegisterPointer }, min_block_address, max_block_address);
auto stack_reference = bit_cast<FlatPtr>(&dummy);
auto& stack_info = m_vm.stack_info();
for (FlatPtr stack_address = stack_reference; stack_address < stack_info.top(); stack_address += sizeof(FlatPtr)) {
for (FlatPtr stack_address = stack_reference; stack_address < m_stack_info.top(); stack_address += sizeof(FlatPtr)) {
auto data = *reinterpret_cast<FlatPtr*>(stack_address);
add_possible_value(possible_pointers, data, HeapRoot { .type = HeapRoot::Type::StackPointer }, min_block_address, max_block_address);
gather_asan_fake_stack_roots(possible_pointers, data, min_block_address, max_block_address);

View file

@ -11,6 +11,7 @@
#include <AK/IntrusiveList.h>
#include <AK/Noncopyable.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/StackInfo.h>
#include <AK/Types.h>
#include <AK/Vector.h>
#include <LibCore/Forward.h>
@ -155,6 +156,7 @@ private:
bool m_should_gc_when_deferral_ends { false };
bool m_collecting_garbage { false };
StackInfo m_stack_info;
};
inline void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl)