| 444 | } |
| 445 | |
| 446 | TypeCode 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 | |
| 485 | void Executor::cleanNumericVal(ValVariant &Val, |
| 486 | const ValType &Type) const noexcept { |
nothing calls this directly
no test coverage detected