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

Class ValType

include/common/types.h:86–306  ·  view source on GitHub ↗

ValType class definition.

Source from the content-addressed store, hash-verified

84
85/// ValType class definition.
86class ValType {
87public:
88 // Note: The padding bytes are reserved and should not be written.
89 ValType() noexcept = default;
90 // General constructors for initializing data.
91 ValType(TypeCode C, TypeCode HT, uint32_t I) noexcept {
92 Inner.Data.Externalize = 0;
93 Inner.Data.Code = C;
94 Inner.Data.HTCode = HT;
95 Inner.Data.Idx = I;
96 }
97 ValType(const std::array<uint8_t, 8> R) noexcept {
98 std::copy_n(R.cbegin(), 8, Inner.Raw);
99 }
100 // Constructor for the value type codes without heap type immediates.
101 ValType(TypeCode C) noexcept {
102 Inner.Data.Externalize = 0;
103 Inner.Data.Idx = 0;
104 switch (C) {
105 case TypeCode::I32:
106 case TypeCode::I64:
107 case TypeCode::F32:
108 case TypeCode::F64:
109 // Number type
110 case TypeCode::V128:
111 // Vector type
112 case TypeCode::I8:
113 case TypeCode::I16:
114 // Packed type
115 Inner.Data.Code = C;
116 Inner.Data.HTCode = TypeCode::Epsilon;
117 break;
118 case TypeCode::NullExnRef:
119 case TypeCode::NullFuncRef:
120 case TypeCode::NullExternRef:
121 case TypeCode::NullRef:
122 case TypeCode::FuncRef:
123 case TypeCode::ExternRef:
124 case TypeCode::AnyRef:
125 case TypeCode::EqRef:
126 case TypeCode::I31Ref:
127 case TypeCode::StructRef:
128 case TypeCode::ArrayRef:
129 case TypeCode::ExnRef:
130 // Abstract heap type
131 Inner.Data.Code = TypeCode::RefNull;
132 Inner.Data.HTCode = C;
133 break;
134 case TypeCode::Ref:
135 case TypeCode::RefNull:
136 // Reference type with heap immediates should use the constructors below.
137 default:
138 assumingUnreachable();
139 }
140 }
141 // Constructor for the value type with abs heap type in reference type.
142 ValType(TypeCode C, TypeCode HT) noexcept {
143 Inner.Data.Externalize = 0;

Callers 15

compileMethod · 0.85
checkInstrMethod · 0.85
validateMethod · 0.85
invokeMethod · 0.85
enterFunctionMethod · 0.85
throwExceptionMethod · 0.85
instantiateMethod · 0.85
runRefTestOpMethod · 0.85
runRefConvOpMethod · 0.85
runRefI31OpMethod · 0.85
runBrOnCastOpMethod · 0.85
proxyRefTestMethod · 0.85

Calls

no outgoing calls

Tested by 3

TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68