/src/WasmEdge/include/executor/engine/memory.ipp
Line | Count | Source |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: Copyright The WasmEdge Authors |
3 | | |
4 | | #include "executor/engine/vector_helper.h" |
5 | | #include "executor/executor.h" |
6 | | #include "experimental/bit.hpp" |
7 | | #include "experimental/simd/ext.hpp" |
8 | | #include "runtime/instance/memory.h" |
9 | | |
10 | | #include <cstdint> |
11 | | |
12 | | namespace WasmEdge { |
13 | | namespace Executor { |
14 | | |
15 | | template <typename T, uint32_t BitWidth> |
16 | | TypeT<T> Executor::runLoadOp(Runtime::StackManager &StackMgr, |
17 | | Runtime::Instance::MemoryInstance &MemInst, |
18 | 0 | const AST::Instruction &Instr) { |
19 | | // Calculate EA |
20 | 0 | ValVariant &Val = StackMgr.getTop(); |
21 | 0 | const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType(); |
22 | 0 | uint64_t EA = extractAddr(Val, AddrType); |
23 | 0 | EXPECTED_TRY(checkOffsetOverflow(MemInst, Instr, EA, BitWidth / 8)); |
24 | 0 | EA += Instr.getMemoryOffset(); |
25 | | // Value = Mem.Data[EA : N / 8] |
26 | 0 | return MemInst.loadValue<T, BitWidth / 8>(Val.emplace<T>(), EA) |
27 | 0 | .map_error([&Instr](auto E) { |
28 | 0 | spdlog::error( |
29 | 0 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
30 | 0 | return E; |
31 | 0 | }); Unexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned int, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned long, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<float, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<double, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<int, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned int, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<int, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned int, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<long, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned long, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<long, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned long, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<long, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned long, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned __int128, 128u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned __int128, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadOp<unsigned __int128, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) const |
32 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned int, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned long, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<float, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<double, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<int, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned int, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<int, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned int, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<long, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned long, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<long, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned long, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<long, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned long, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned __int128>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned __int128, 128u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned __int128>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned __int128, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned __int128>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runLoadOp<unsigned __int128, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) |
33 | | |
34 | | template <typename T, uint32_t BitWidth> |
35 | | TypeN<T> Executor::runStoreOp(Runtime::StackManager &StackMgr, |
36 | | Runtime::Instance::MemoryInstance &MemInst, |
37 | 0 | const AST::Instruction &Instr) { |
38 | | // Pop the value t.const c from the Stack |
39 | 0 | T C = StackMgr.pop().get<T>(); |
40 | | |
41 | | // Calculate EA = i + offset |
42 | 0 | const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType(); |
43 | 0 | uint64_t I = extractAddr(StackMgr.pop(), AddrType); |
44 | 0 | EXPECTED_TRY(checkOffsetOverflow(MemInst, Instr, I, BitWidth / 8)); |
45 | 0 | uint64_t EA = I + Instr.getMemoryOffset(); |
46 | | |
47 | | // Store value to bytes. |
48 | 0 | return MemInst.storeValue<T, BitWidth / 8>(C, EA).map_error([&Instr](auto E) { |
49 | 0 | spdlog::error( |
50 | 0 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
51 | 0 | return E; |
52 | 0 | }); Unexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned int, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned long, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<float, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<double, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned int, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned int, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned long, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned long, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned long, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreOp<unsigned __int128, 128u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) const |
53 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned int, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned long, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<float, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<double, 64u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned int, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned int, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned long, 8u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned long, 16u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned long, 32u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned __int128>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runStoreOp<unsigned __int128, 128u>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) |
54 | | |
55 | | template <typename TIn, typename TOut> |
56 | | Expect<void> |
57 | | Executor::runLoadExpandOp(Runtime::StackManager &StackMgr, |
58 | | Runtime::Instance::MemoryInstance &MemInst, |
59 | 0 | const AST::Instruction &Instr) { |
60 | 0 | static_assert(sizeof(TOut) == sizeof(TIn) * 2); |
61 | | // Calculate EA |
62 | 0 | ValVariant &Val = StackMgr.getTop(); |
63 | 0 | const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType(); |
64 | 0 | uint64_t EA = extractAddr(Val, AddrType); |
65 | 0 | EXPECTED_TRY(checkOffsetOverflow(MemInst, Instr, EA, 8)); |
66 | 0 | EA += Instr.getMemoryOffset(); |
67 | | |
68 | | // Value = Mem.Data[EA : N / 8] |
69 | 0 | uint64_t Buffer; |
70 | 0 | return MemInst.loadValue<decltype(Buffer), 8>(Buffer, EA) |
71 | 0 | .map_error([&Instr](auto E) { |
72 | 0 | spdlog::error( |
73 | 0 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
74 | 0 | return E; |
75 | 0 | }) Unexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadExpandOp<signed char, short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadExpandOp<unsigned char, unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadExpandOp<short, int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadExpandOp<unsigned short, unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadExpandOp<int, long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadExpandOp<unsigned int, unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) const |
76 | 0 | .map([&]() { |
77 | 0 | using VTIn = SIMDArray<TIn, 8>; |
78 | 0 | using VTOut = SIMDArray<TOut, 16>; |
79 | |
|
80 | 0 | const auto Value = cxx20::bit_cast<VTIn>(Buffer); |
81 | |
|
82 | 0 | Val.emplace<VTOut>(VTOut(Value)); |
83 | 0 | }); Unexecuted instantiation: WasmEdge::Executor::Executor::runLoadExpandOp<signed char, short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadExpandOp<unsigned char, unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadExpandOp<short, int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadExpandOp<unsigned short, unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadExpandOp<int, long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadExpandOp<unsigned int, unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() const |
84 | 0 | } Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadExpandOp<signed char, short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadExpandOp<unsigned char, unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadExpandOp<short, int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadExpandOp<unsigned short, unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadExpandOp<int, long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadExpandOp<unsigned int, unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) |
85 | | |
86 | | template <typename T> |
87 | | Expect<void> |
88 | | Executor::runLoadSplatOp(Runtime::StackManager &StackMgr, |
89 | | Runtime::Instance::MemoryInstance &MemInst, |
90 | 0 | const AST::Instruction &Instr) { |
91 | | // Calculate EA |
92 | 0 | ValVariant &Val = StackMgr.getTop(); |
93 | 0 | const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType(); |
94 | 0 | uint64_t EA = extractAddr(Val, AddrType); |
95 | 0 | EXPECTED_TRY(checkOffsetOverflow(MemInst, Instr, EA, sizeof(T))); |
96 | 0 | EA += Instr.getMemoryOffset(); |
97 | | |
98 | | // Value = Mem.Data[EA : N / 8] |
99 | 0 | using VT = SIMDArray<T, 16>; |
100 | 0 | uint64_t Buffer; |
101 | 0 | return MemInst.loadValue<decltype(Buffer), sizeof(T)>(Buffer, EA) |
102 | 0 | .map_error([&Instr](auto E) { |
103 | 0 | spdlog::error( |
104 | 0 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
105 | 0 | return E; |
106 | 0 | }) Unexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadSplatOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadSplatOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadSplatOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadSplatOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) const |
107 | 0 | .map([&]() { |
108 | 0 | const T Part = static_cast<T>(Buffer); |
109 | |
|
110 | 0 | Val.emplace<VT>(VT(Part)); |
111 | 0 | }); Unexecuted instantiation: WasmEdge::Executor::Executor::runLoadSplatOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadSplatOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadSplatOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadSplatOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() const |
112 | 0 | } Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadSplatOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadSplatOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadSplatOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadSplatOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) |
113 | | |
114 | | template <typename T> |
115 | | Expect<void> Executor::runLoadLaneOp(Runtime::StackManager &StackMgr, |
116 | | Runtime::Instance::MemoryInstance &MemInst, |
117 | 0 | const AST::Instruction &Instr) { |
118 | 0 | using VT = SIMDArray<T, 16>; |
119 | 0 | VT Result = StackMgr.pop().get<VT>(); |
120 | 0 | const auto Lane = detail::lane<T>(Instr.getMemoryLane()); |
121 | | // Calculate EA |
122 | 0 | ValVariant &Val = StackMgr.getTop(); |
123 | 0 | const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType(); |
124 | 0 | uint64_t EA = extractAddr(Val, AddrType); |
125 | 0 | EXPECTED_TRY(checkOffsetOverflow(MemInst, Instr, EA, sizeof(T))); |
126 | 0 | EA += Instr.getMemoryOffset(); |
127 | | |
128 | | // Value = Mem.Data[EA : N / 8] |
129 | 0 | uint64_t Buffer; |
130 | 0 | return MemInst.loadValue<decltype(Buffer), sizeof(T)>(Buffer, EA) |
131 | 0 | .map_error([&Instr](auto E) { |
132 | 0 | spdlog::error( |
133 | 0 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
134 | 0 | return E; |
135 | 0 | }) Unexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadLaneOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadLaneOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadLaneOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runLoadLaneOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) const |
136 | 0 | .map([&]() { |
137 | 0 | cxx26::simd_ext::replace_lane(Result, Lane, static_cast<T>(Buffer)); |
138 | 0 | Val.emplace<VT>(Result); |
139 | 0 | }); Unexecuted instantiation: WasmEdge::Executor::Executor::runLoadLaneOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadLaneOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadLaneOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() constUnexecuted instantiation: WasmEdge::Executor::Executor::runLoadLaneOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda()#1}::operator()() const |
140 | 0 | } Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadLaneOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadLaneOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadLaneOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runLoadLaneOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) |
141 | | |
142 | | template <typename T> |
143 | | Expect<void> |
144 | | Executor::runStoreLaneOp(Runtime::StackManager &StackMgr, |
145 | | Runtime::Instance::MemoryInstance &MemInst, |
146 | 0 | const AST::Instruction &Instr) { |
147 | 0 | using VT = SIMDArray<T, 16>; |
148 | 0 | using TBuf = std::conditional_t<sizeof(T) < 4, uint32_t, T>; |
149 | 0 | const auto Lane = detail::lane<T>(Instr.getMemoryLane()); |
150 | 0 | const TBuf C = StackMgr.pop().get<VT>()[Lane]; |
151 | | |
152 | | // Calculate EA = i + offset |
153 | 0 | const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType(); |
154 | 0 | uint64_t I = extractAddr(StackMgr.pop(), AddrType); |
155 | 0 | EXPECTED_TRY(checkOffsetOverflow(MemInst, Instr, I, sizeof(T))); |
156 | 0 | uint64_t EA = I + Instr.getMemoryOffset(); |
157 | | |
158 | | // Store value to bytes. |
159 | 0 | return MemInst.storeValue<decltype(C), sizeof(T)>(C, EA).map_error( |
160 | 0 | [&Instr](auto E) { |
161 | 0 | spdlog::error( |
162 | 0 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
163 | 0 | return E; |
164 | 0 | }); Unexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreLaneOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreLaneOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreLaneOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) constUnexecuted instantiation: auto WasmEdge::Executor::Executor::runStoreLaneOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&)::{lambda(auto:1)#1}::operator()<WasmEdge::ErrCode>(WasmEdge::ErrCode) const |
165 | 0 | } Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runStoreLaneOp<unsigned char>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runStoreLaneOp<unsigned short>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runStoreLaneOp<unsigned int>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) Unexecuted instantiation: cxx20::expected<void, WasmEdge::ErrCode> WasmEdge::Executor::Executor::runStoreLaneOp<unsigned long>(WasmEdge::Runtime::StackManager&, WasmEdge::Runtime::Instance::MemoryInstance&, WasmEdge::AST::Instruction const&) |
166 | | |
167 | | } // namespace Executor |
168 | | } // namespace WasmEdge |