MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / unsafeRunWasmFile

Method unsafeRunWasmFile

lib/vm/vm.cpp:228–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228Expect<std::vector<std::pair<ValVariant, ValType>>>
229VM::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
252Expect<std::vector<std::pair<ValVariant, ValType>>>
253VM::unsafeRunWasmFile(Span<const Byte> Code, std::string_view Func,

Callers

nothing calls this directly

Calls 7

UnexpectFunction · 0.85
InfoExecutingClass · 0.85
instantiateModuleMethod · 0.80
EXPECTED_TRYFunction · 0.50
errorFunction · 0.50
validateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected