Skip to content

Commit f4c5cbb

Browse files
committed
Make it explicit that we don't support Wasm m128 globals at this time
1 parent ad1f74e commit f4c5cbb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/WasmReader/WasmBinaryReader.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,24 @@ void WasmBinaryReader::ReadGlobalSection()
10671067
for (uint32 i = 0; i < numGlobals; ++i)
10681068
{
10691069
WasmTypes::WasmType type = ReadWasmType(len);
1070+
1071+
if (!WasmTypes::IsLocalType(type))
1072+
{
1073+
ThrowDecodingError(_u("Invalid global type %u"), type);
1074+
}
1075+
switch (type)
1076+
{
1077+
case WasmTypes::I32: break; // Handled
1078+
case WasmTypes::I64: break; // Handled
1079+
case WasmTypes::F32: break; // Handled
1080+
case WasmTypes::F64: break; // Handled
1081+
#ifdef ENABLE_WASM_SIMD
1082+
case WasmTypes::M128: ThrowDecodingError(_u("m128 globals not supported"));
1083+
#endif
1084+
default:
1085+
WasmTypes::CompileAssertCases<WasmTypes::I32, WasmTypes::I64, WasmTypes::F32, WasmTypes::F64, WASM_M128_CHECK_TYPE>();
1086+
}
1087+
10701088
bool isMutable = ReadMutableValue();
10711089
WasmNode globalNode = ReadInitExpr();
10721090
GlobalReferenceTypes::Type refType = GlobalReferenceTypes::Const;

0 commit comments

Comments
 (0)