| 362 | } |
| 363 | |
| 364 | Expect<void> Executor::runRefConvOp(RefVariant &Ref, |
| 365 | TypeCode TCode) const noexcept { |
| 366 | if (TCode == TypeCode::AnyRef) { |
| 367 | // Internalize. |
| 368 | if (Ref.isNull()) { |
| 369 | Ref = RefVariant(ValType(TypeCode::RefNull, TypeCode::NullRef)); |
| 370 | } else { |
| 371 | Ref.getType().setInternalized(); |
| 372 | if (Ref.getType().isExternRefType()) { |
| 373 | Ref.getType() = ValType(TypeCode::Ref, TypeCode::AnyRef); |
| 374 | } |
| 375 | } |
| 376 | } else { |
| 377 | // Externalize. |
| 378 | if (Ref.isNull()) { |
| 379 | Ref = RefVariant(ValType(TypeCode::RefNull, TypeCode::NullExternRef)); |
| 380 | } else { |
| 381 | // Use the externalize flag because the value type information should be |
| 382 | // reserved when a reference being externalized and internalized. |
| 383 | Ref.getType().setExternalized(); |
| 384 | } |
| 385 | } |
| 386 | return {}; |
| 387 | } |
| 388 | |
| 389 | Expect<void> Executor::runRefI31Op(ValVariant &Val) const noexcept { |
| 390 | uint32_t RefNum = (Val.get<uint32_t>() & 0x7FFFFFFFU) | 0x80000000U; |
nothing calls this directly
no test coverage detected