mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
LibWasm: Fix loop arity for single-type blocktypes
Single-type blocktypes previously gave loop labels an arity of 1, even though they're shorthand for `[] -> [T]`.
This commit is contained in:
parent
625fbc8085
commit
d07cf26894
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/dzfrias
Commit: d07cf26894
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/559
1 changed files with 3 additions and 13 deletions
|
@ -545,23 +545,13 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
|
|||
return;
|
||||
}
|
||||
case Instructions::loop.value(): {
|
||||
size_t arity = 0;
|
||||
size_t parameter_count = 0;
|
||||
auto& args = instruction.arguments().get<Instruction::StructuredInstructionArgs>();
|
||||
switch (args.block_type.kind()) {
|
||||
case BlockType::Empty:
|
||||
break;
|
||||
case BlockType::Type:
|
||||
arity = 1;
|
||||
break;
|
||||
case BlockType::Index: {
|
||||
size_t arity = 0;
|
||||
if (args.block_type.kind() == BlockType::Index) {
|
||||
auto& type = configuration.frame().module().types()[args.block_type.type_index().value()];
|
||||
arity = type.parameters().size();
|
||||
parameter_count = type.parameters().size();
|
||||
}
|
||||
}
|
||||
|
||||
configuration.stack().entries().insert(configuration.stack().size() - parameter_count, Label(arity, ip.value() + 1));
|
||||
configuration.stack().entries().insert(configuration.stack().size() - arity, Label(arity, ip.value() + 1));
|
||||
return;
|
||||
}
|
||||
case Instructions::if_.value(): {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue