mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-06 16:09:30 +00:00
LibWasm: Add missing spec extern and prevent spec extern re-use
Add the missing `print` function to the spectest namespace. Also, spec externs cannot be re-used because operations that modify "memory", for example, will carry over into subsequent spec test runs. This can be remedied in the future by implementing some sort of garbage collector for allocations in the store. (cherry picked from commit 1e19be412f17f99e5c3979ccf790c3ca90d637d6)
This commit is contained in:
parent
a91f00fed7
commit
53aaa56ce8
|
@ -80,8 +80,9 @@ private:
|
||||||
|
|
||||||
static HashMap<Wasm::Linker::Name, Wasm::ExternValue> const& spec_test_namespace()
|
static HashMap<Wasm::Linker::Name, Wasm::ExternValue> const& spec_test_namespace()
|
||||||
{
|
{
|
||||||
if (!s_spec_test_namespace.is_empty())
|
Wasm::FunctionType print_type { {}, {} };
|
||||||
return s_spec_test_namespace;
|
auto address_print = alloc_noop_function(print_type);
|
||||||
|
s_spec_test_namespace.set({ "spectest", "print", print_type }, Wasm::ExternValue { *address_print });
|
||||||
|
|
||||||
Wasm::FunctionType print_i32_type { { Wasm::ValueType(Wasm::ValueType::I32) }, {} };
|
Wasm::FunctionType print_i32_type { { Wasm::ValueType(Wasm::ValueType::I32) }, {} };
|
||||||
auto address_i32 = alloc_noop_function(print_i32_type);
|
auto address_i32 = alloc_noop_function(print_i32_type);
|
||||||
|
|
Loading…
Reference in a new issue