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

Method runRefConvOp

lib/executor/engine/refInstr.cpp:364–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364Expect<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
389Expect<void> Executor::runRefI31Op(ValVariant &Val) const noexcept {
390 uint32_t RefNum = (Val.get<uint32_t>() & 0x7FFFFFFFU) | 0x80000000U;

Callers

nothing calls this directly

Calls 7

RefVariantClass · 0.85
ValTypeClass · 0.85
isNullMethod · 0.80
setInternalizedMethod · 0.80
isExternRefTypeMethod · 0.80
setExternalizedMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected