| 226 | } |
| 227 | |
| 228 | Expect<std::vector<std::pair<ValVariant, ValType>>> |
| 229 | VM::unsafeRunWasmFile(const std::filesystem::path &Path, std::string_view Func, |
| 230 | Span<const ValVariant> Params, |
| 231 | Span<const ValType> ParamTypes) { |
| 232 | if (Stage == VMStage::Instantiated) { |
| 233 | // When running another module, the instantiated module in the store will be |
| 234 | // reset. Therefore the instantiation should restart. |
| 235 | Stage = VMStage::Validated; |
| 236 | } |
| 237 | // Load wasm unit. |
| 238 | EXPECTED_TRY(auto ComponentOrModule, LoaderEngine.parseWasmUnit(Path)); |
| 239 | return std::visit( |
| 240 | VisitUnit<Expect<std::vector<std::pair<ValVariant, ValType>>>>( |
| 241 | [&](auto &M) -> Expect<std::vector<std::pair<ValVariant, ValType>>> { |
| 242 | Mod = std::move(M); |
| 243 | return unsafeRunWasmFile(*Mod, Func, Params, ParamTypes); |
| 244 | }, |
| 245 | [&](auto &C) -> Expect<std::vector<std::pair<ValVariant, ValType>>> { |
| 246 | Comp = std::move(C); |
| 247 | return unsafeRunWasmFile(*Comp, Func, Params, ParamTypes); |
| 248 | }), |
| 249 | ComponentOrModule); |
| 250 | } |
| 251 | |
| 252 | Expect<std::vector<std::pair<ValVariant, ValType>>> |
| 253 | VM::unsafeRunWasmFile(Span<const Byte> Code, std::string_view Func, |
nothing calls this directly
no test coverage detected