LibWasm: Give some inline capacity to the frame and label stacks

The average wasm function rarely goes over these bounds for the labels
(32 nested control structures), and 8 frames is just enough to clear
most initialization code/start section without allocating anything.
This commit is contained in:
Ali Mohammad Pur
2025-06-06 14:13:28 +02:00
committed by Ali Mohammad Pur
parent bf4c436ef3
commit 931b554f68
Notes: github-actions[bot] 2025-08-08 10:56:39 +00:00
3 changed files with 5 additions and 3 deletions

View File

@@ -193,6 +193,7 @@ public:
private:
u128 m_value;
};
static_assert(IsTriviallyDestructible<Value>);
struct ExternallyManagedTrap {
Array<u8, 64> data;

View File

@@ -13,7 +13,7 @@ namespace Wasm {
void Configuration::unwind(Badge<CallFrameHandle>, CallFrameHandle const& frame_handle)
{
auto frame = m_frame_stack.take_last();
m_frame_stack.take_last();
m_depth--;
m_ip = frame_handle.ip;
}

View File

@@ -6,6 +6,7 @@
#pragma once
#include <AK/DoublyLinkedList.h>
#include <LibWasm/AbstractMachine/AbstractMachine.h>
namespace Wasm {
@@ -68,8 +69,8 @@ public:
private:
Store& m_store;
Vector<Value> m_value_stack;
Vector<Label> m_label_stack;
Vector<Frame> m_frame_stack;
DoublyLinkedList<Label, 32> m_label_stack;
DoublyLinkedList<Frame, 32> m_frame_stack;
size_t m_depth { 0 };
InstructionPointer m_ip;
bool m_should_limit_instruction_count { false };