diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp index 28dd42b8216..22ecd12bbb4 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp +++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp @@ -236,32 +236,9 @@ void BytecodeInterpreter::pop_and_push_m_splat(Wasm::Configuration& configuratio } template typename SetSign, typename VectorType> -Optional BytecodeInterpreter::pop_vector(Configuration& configuration) +VectorType BytecodeInterpreter::pop_vector(Configuration& configuration) { - auto value = peek_vector(configuration); - if (value.has_value()) - configuration.stack().pop(); - return value; -} - -template typename SetSign, typename VectorType> -Optional BytecodeInterpreter::peek_vector(Configuration& configuration) -{ - auto& entry = configuration.stack().peek(); - auto value = entry.get().value().get_pointer(); - if (!value) - return {}; - auto vector = bit_cast(*value); - dbgln_if(WASM_TRACE_DEBUG, "stack({}) peek-> vector({:x})", *value, bit_cast(vector)); - return vector; -} - -template -static u128 shuffle_vector(VectorType values, VectorType indices) -{ - auto vector = bit_cast(values); - auto indices_vector = bit_cast(indices); - return bit_cast(shuffle_or_0(vector, indices_vector)); + return bit_cast(configuration.stack().pop().get().value().get()); } void BytecodeInterpreter::call_address(Configuration& configuration, FunctionAddress address) @@ -1290,8 +1267,8 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi return pop_and_push_m_splat<64, NativeFloatingType>(configuration, instruction); case Instructions::i8x16_shuffle.value(): { auto& arg = instruction.arguments().get(); - auto b = *pop_vector(configuration); - auto a = *pop_vector(configuration); + auto b = pop_vector(configuration); + auto a = pop_vector(configuration); using VectorType = Native128ByteVectorOf; VectorType result; for (size_t i = 0; i < 16; ++i) diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h index 55977082503..48aa8774e15 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h @@ -65,9 +65,7 @@ protected: template typename NativeType> void pop_and_push_m_splat(Configuration&, Instruction const&); template typename SetSign, typename VectorType = Native128ByteVectorOf> - Optional pop_vector(Configuration&); - template typename SetSign, typename VectorType = Native128ByteVectorOf> - Optional peek_vector(Configuration&); + VectorType pop_vector(Configuration&); void store_to_memory(Configuration&, Instruction::MemoryArgument const&, ReadonlyBytes data, u32 base); void call_address(Configuration&, FunctionAddress);