| 356 | } |
| 357 | |
| 358 | Expect<uint32_t> Executor::proxyRefTest(Runtime::StackManager &StackMgr, |
| 359 | const RefVariant Ref, |
| 360 | ValType VTTest) noexcept { |
| 361 | // Copy the value type here due to handling the externalized case. |
| 362 | auto VT = Ref.getType(); |
| 363 | if (VT.isExternalized()) { |
| 364 | VT = ValType(TypeCode::Ref, TypeCode::ExternRef); |
| 365 | } |
| 366 | const auto *ModInst = StackMgr.getModule(); |
| 367 | assuming(ModInst); |
| 368 | Span<const AST::SubType *const> GotTypeList = ModInst->getTypeList(); |
| 369 | if (!VT.isAbsHeapType()) { |
| 370 | auto *Inst = Ref.getPtr<Runtime::Instance::CompositeBase>(); |
| 371 | // Reference must not be nullptr here because the null references are typed |
| 372 | // with the least abstract heap type. |
| 373 | if (Inst->getModule()) { |
| 374 | GotTypeList = Inst->getModule()->getTypeList(); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | if (AST::TypeMatcher::matchType(ModInst->getTypeList(), VTTest, GotTypeList, |
| 379 | VT)) { |
| 380 | return static_cast<uint32_t>(1); |
| 381 | } else { |
| 382 | return static_cast<uint32_t>(0); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | Expect<RefVariant> Executor::proxyRefCast(Runtime::StackManager &StackMgr, |
| 387 | const RefVariant Ref, |
nothing calls this directly
no test coverage detected