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

Method toBottomType

lib/executor/helper.cpp:446–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446TypeCode Executor::toBottomType(Runtime::StackManager &StackMgr,
447 const ValType &Type) const {
448 if (Type.isRefType()) {
449 if (Type.isAbsHeapType()) {
450 switch (Type.getHeapTypeCode()) {
451 case TypeCode::NullFuncRef:
452 case TypeCode::FuncRef:
453 return TypeCode::NullFuncRef;
454 case TypeCode::NullExternRef:
455 case TypeCode::ExternRef:
456 return TypeCode::NullExternRef;
457 case TypeCode::NullRef:
458 case TypeCode::AnyRef:
459 case TypeCode::EqRef:
460 case TypeCode::I31Ref:
461 case TypeCode::StructRef:
462 case TypeCode::ArrayRef:
463 return TypeCode::NullRef;
464 case TypeCode::NullExnRef:
465 case TypeCode::ExnRef:
466 return TypeCode::NullExnRef;
467 default:
468 assumingUnreachable();
469 }
470 } else {
471 const auto &CompType =
472 (*StackMgr.getModule()->getType(Type.getTypeIndex()))
473 ->getCompositeType();
474 if (CompType.isFunc()) {
475 return TypeCode::NullFuncRef;
476 } else {
477 return TypeCode::NullRef;
478 }
479 }
480 } else {
481 return Type.getCode();
482 }
483}
484
485void Executor::cleanNumericVal(ValVariant &Val,
486 const ValType &Type) const noexcept {

Callers

nothing calls this directly

Calls 8

isRefTypeMethod · 0.80
isAbsHeapTypeMethod · 0.80
getHeapTypeCodeMethod · 0.80
getTypeMethod · 0.45
getModuleMethod · 0.45
getTypeIndexMethod · 0.45
isFuncMethod · 0.45
getCodeMethod · 0.45

Tested by

no test coverage detected