diff --git a/src/wasm-type.h b/src/wasm-type.h index 6b337530a24..a72ba9d2cfa 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -95,13 +95,13 @@ class HeapType { // should also be passed by value. uintptr_t id; - static constexpr int TypeBits = 3; + static constexpr int TypeBits = 2; static constexpr int UsedBits = TypeBits + 1; static constexpr int SharedMask = 1 << TypeBits; public: - // Bits 0-2 are used by the Type representation, so need to be left free. - // Bit 3 determines whether the basic heap type is shared (1) or unshared (0). + // Bits 0-1 are used by the Type representation, so need to be left free. + // Bit 2 determines whether the basic heap type is shared (1) or unshared (0). enum BasicHeapType : uint32_t { ext = 1 << UsedBits, func = 2 << UsedBits, @@ -278,7 +278,7 @@ class Type { // bit 0 set. When that bit is masked off, they are pointers to the underlying // vectors of types. Otherwise, the type is a reference type, and is // represented as a heap type with bit 1 set iff the reference type is - // nullable and bit 2 set iff the reference type is exact. + // nullable. // // Since `Type` is really just a single integer, it should be passed by value. // This is a uintptr_t rather than a TypeID (uint64_t) to save memory on @@ -287,7 +287,6 @@ class Type { static constexpr int TupleMask = 1 << 0; static constexpr int NullMask = 1 << 1; - static constexpr int ExactMask = 1 << 2; public: enum BasicType : uint32_t { @@ -320,8 +319,7 @@ class Type { // Signature, Struct or Array via implicit conversion to HeapType. Type(HeapType heapType, Nullability nullable) : Type(heapType.getID() | (nullable == Nullable ? NullMask : 0)) { - assert(heapType.isBasic() || - !(heapType.getID() & (TupleMask | NullMask | ExactMask))); + assert(heapType.isBasic() || !(heapType.getID() & (TupleMask | NullMask))); } // Predicates @@ -372,7 +370,7 @@ class Type { bool isNonNullable() const { return isRef() && !(id & NullMask); } HeapType getHeapType() const { assert(isRef()); - return HeapType(id & ~(NullMask | ExactMask)); + return HeapType(id & ~NullMask); } bool isFunction() const { return isRef() && getHeapType().isFunction(); } diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 9bfc45ddf72..78f1c73552f 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -20,17 +20,17 @@ BinaryenTypeAuto: -1 BinaryenPackedTypeNotPacked: 0 BinaryenPackedTypeInt8: 1 BinaryenPackedTypeInt16: 2 -BinaryenHeapTypeExt: 16 -BinaryenHeapTypeFunc: 32 -BinaryenHeapTypeAny: 64 -BinaryenHeapTypeEq: 80 -BinaryenHeapTypeI31: 96 -BinaryenHeapTypeStruct: 112 -BinaryenHeapTypeArray: 128 -BinaryenHeapTypeString: 160 -BinaryenHeapTypeNone: 176 -BinaryenHeapTypeNoext: 192 -BinaryenHeapTypeNofunc: 208 +BinaryenHeapTypeExt: 8 +BinaryenHeapTypeFunc: 16 +BinaryenHeapTypeAny: 32 +BinaryenHeapTypeEq: 40 +BinaryenHeapTypeI31: 48 +BinaryenHeapTypeStruct: 56 +BinaryenHeapTypeArray: 64 +BinaryenHeapTypeString: 80 +BinaryenHeapTypeNone: 88 +BinaryenHeapTypeNoext: 96 +BinaryenHeapTypeNofunc: 104 BinaryenFeatureMVP: 0 BinaryenFeatureAtomics: 1 BinaryenFeatureBulkMemory: 16