LibWasm+LibWeb: Allow tables to have externrefs in the JS API

This commit is contained in:
Diego Frias
2024-08-17 15:40:21 -07:00
committed by Ali Mohammad Pur
parent fc83653f3c
commit 4e7d3026d2
8 changed files with 56 additions and 13 deletions

View File

@@ -36,6 +36,9 @@ Optional<TableAddress> Store::allocate(TableType const& type)
{
TableAddress address { m_tables.size() };
Vector<Reference> elements;
elements.ensure_capacity(type.limits().min());
for (size_t i = 0; i < type.limits().min(); i++)
elements.append(Wasm::Reference { Wasm::Reference::Null { type.element_type() } });
elements.resize(type.limits().min());
m_tables.empend(TableInstance { type, move(elements) });
return address;