1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

LibDebug: Avoid short lived allocations in DIE::for_each_child

This algorithm is both iterative and recursive, so allocating on every
recursion, or when iterating each child is extremely costly.

Instead allow the on stack DIE to be re-initialized so it can be reused.
This commit is contained in:
Brian Gianforcaro 2021-09-17 02:12:29 -07:00 committed by Andreas Kling
parent 19c492e976
commit 952441943f
2 changed files with 17 additions and 12 deletions

View file

@ -36,6 +36,7 @@ public:
Optional<u32> parent_offset() const { return m_parent_offset; }
private:
void rehydrate_from(u32 offset, Optional<u32> parent_offset);
CompilationUnit const& m_compilation_unit;
u32 m_offset { 0 };
u32 m_data_offset { 0 };