Skip to content

Commit 402e151

Browse files
alimpfardawesomekling
authored andcommitted
LibWasm: Move the "rest" of br_if.nostack into a separate function
...instead of a lambda, so gcc doesn't have to deal with annotations on lambdas.
1 parent dd9a87d commit 402e151

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,12 @@ HANDLE_INSTRUCTION(br_if)
21752175
TAILCALL return continue_(HANDLER_PARAMS(DECOMPOSE_PARAMS_NAME_ONLY));
21762176
}
21772177

2178+
NEVER_INLINE static Outcome synthetic_br_if_nostack_not_taken(HANDLER_PARAMS(DECOMPOSE_PARAMS))
2179+
{
2180+
short_ip.current_ip_value = interpreter.branch_to_label<true>(configuration, instruction->arguments().unsafe_get<Instruction::BranchArgs>().label, short_ip.current_ip_value).value();
2181+
TAILCALL return continue_(HANDLER_PARAMS(DECOMPOSE_PARAMS_NAME_ONLY));
2182+
}
2183+
21782184
HANDLE_INSTRUCTION(synthetic_br_if_nostack)
21792185
{
21802186
LOG_INSN;
@@ -2190,13 +2196,8 @@ HANDLE_INSTRUCTION(synthetic_br_if_nostack)
21902196
auto& label = label_stack.data()[label_pos];
21912197
auto expected = label.stack_height() + label.arity();
21922198
auto current = configuration.value_stack().size();
2193-
if (current != expected) [[unlikely]] {
2194-
// This branch is definitely taken, but we have to tailcall a different function so we don't pollute this one with vector reallocation nonsense.
2195-
return [](HANDLER_PARAMS(DECOMPOSE_PARAMS)) NEVER_INLINE static {
2196-
short_ip.current_ip_value = interpreter.branch_to_label<true>(configuration, instruction->arguments().unsafe_get<Instruction::BranchArgs>().label, short_ip.current_ip_value).value();
2197-
TAILCALL return continue_(HANDLER_PARAMS(DECOMPOSE_PARAMS_NAME_ONLY));
2198-
}(HANDLER_PARAMS(DECOMPOSE_PARAMS_NAME_ONLY));
2199-
}
2199+
if (current != expected) [[unlikely]]
2200+
return synthetic_br_if_nostack_not_taken(HANDLER_PARAMS(DECOMPOSE_PARAMS_NAME_ONLY));
22002201
label_stack.unsafe_shrink(label_pos + 1);
22012202
short_ip.current_ip_value = label.continuation().value() - 1;
22022203
TAILCALL return continue_(HANDLER_PARAMS(DECOMPOSE_PARAMS_NAME_ONLY));

0 commit comments

Comments
 (0)