mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 11:06:10 +00:00
LibWasm: Improve table support
Implements `table.get`, `table.set`, `elem.drop`, `table.size`, and `table.grow`. Also fixes a few issues when generating ref-related spectests. Also changes the `TableInstance` type to use `Vector<Reference>` instead of `Vector<Optional<Reference>>`, because the ability to be null is already encoded in the `Reference` type.
This commit is contained in:
parent
3ca6dfba48
commit
d906255cbb
Notes:
sideshowbarker
2024-07-18 03:35:30 +09:00
Author: https://github.com/dzfrias
Commit: d906255cbb
Pull-request: https://github.com/SerenityOS/serenity/pull/24492
Reviewed-by: https://github.com/alimpfard
6 changed files with 82 additions and 29 deletions
|
@ -242,10 +242,18 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
|
|||
break;
|
||||
}
|
||||
case Wasm::ValueType::Kind::FunctionReference:
|
||||
if (argument.is_null()) {
|
||||
arguments.append(Wasm::Value(Wasm::Reference { Wasm::Reference::Null { Wasm::ValueType(Wasm::ValueType::Kind::FunctionReference) } }));
|
||||
break;
|
||||
}
|
||||
arguments.append(Wasm::Value(Wasm::Reference { Wasm::Reference::Func { static_cast<u64>(double_value) } }));
|
||||
break;
|
||||
case Wasm::ValueType::Kind::ExternReference:
|
||||
arguments.append(Wasm::Value(Wasm::Reference { Wasm::Reference::Func { static_cast<u64>(double_value) } }));
|
||||
if (argument.is_null()) {
|
||||
arguments.append(Wasm::Value(Wasm::Reference { Wasm::Reference::Null { Wasm::ValueType(Wasm::ValueType::Kind::ExternReference) } }));
|
||||
break;
|
||||
}
|
||||
arguments.append(Wasm::Value(Wasm::Reference { Wasm::Reference::Extern { static_cast<u64>(double_value) } }));
|
||||
break;
|
||||
case Wasm::ValueType::Kind::NullFunctionReference:
|
||||
arguments.append(Wasm::Value(Wasm::Reference { Wasm::Reference::Null { Wasm::ValueType(Wasm::ValueType::Kind::FunctionReference) } }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue