diff options
-rw-r--r-- | src/wasm-type.h | 12 | ||||
-rw-r--r-- | src/wasm/wasm-type.cpp | 6 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/wasm-type.h b/src/wasm-type.h index f600f2e79..11980642b 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -174,10 +174,12 @@ public: // Returns the feature set required to use this type. FeatureSet getFeatures() const; - // Gets the heap type corresponding to this type + // Gets the heap type corresponding to this type, assuming that it is a + // reference or Rtt type. HeapType getHeapType() const; - const struct Rtt& getRtt() const; + // Gets the Rtt for this type, assuming that it is an Rtt type. + Rtt getRtt() const; // Returns a number type based on its size in bytes and whether it is a float // type. @@ -432,10 +434,8 @@ struct Array { }; struct Rtt { - enum { - // An Rtt can have no depth specified - NoDepth = -1 - }; + // An Rtt can have no depth specified + static constexpr uint32_t NoDepth = -1; uint32_t depth; HeapType heapType; Rtt(HeapType heapType) : depth(NoDepth), heapType(heapType) {} diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index a27cbabc6..043796ff0 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -531,13 +531,9 @@ HeapType Type::getHeapType() const { } WASM_UNREACHABLE("Unexpected type"); } - if (isRtt()) { - return getRtt().heapType; - } - WASM_UNREACHABLE("unexpected type"); } -const Rtt& Type::getRtt() const { +Rtt Type::getRtt() const { assert(isRtt()); return getTypeInfo(*this)->rtt; } |