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

Method runThrowRefOp

lib/executor/engine/controlInstr.cpp:44–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44Expect<void> Executor::runThrowRefOp(Runtime::StackManager &StackMgr,
45 const AST::Instruction &Instr,
46 AST::InstrView::iterator &PC) noexcept {
47 const auto Ref = StackMgr.pop().get<RefVariant>();
48 if (Ref.isNull()) {
49 spdlog::error(ErrCode::Value::AccessNullException);
50 spdlog::error(
51 ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset()));
52 return Unexpect(ErrCode::Value::AccessNullException);
53 }
54 const auto *ExnInst = Ref.getPtr<Runtime::Instance::ExceptionInstance>();
55 auto *TagInst = ExnInst->getTag();
56 // Re-push the captured payload to mirror an initial `throw`, then unwind.
57 StackMgr.pushValVec(ExnInst->getPayload());
58 return throwException(StackMgr, *TagInst, PC, ExnInst);
59}
60
61Expect<void> Executor::runBrOp(Runtime::StackManager &StackMgr,
62 const AST::Instruction &Instr,

Callers

nothing calls this directly

Calls 9

InfoInstructionClass · 0.85
UnexpectFunction · 0.85
popMethod · 0.80
isNullMethod · 0.80
getTagMethod · 0.80
pushValVecMethod · 0.80
errorFunction · 0.50
getOpCodeMethod · 0.45
getOffsetMethod · 0.45

Tested by

no test coverage detected