summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp66
1 files changed, 7 insertions, 59 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 1a6acf5bd..34b1e82b7 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -931,36 +931,25 @@ void CallRef::finalize(Type type_) {
}
void RefTest::finalize() {
- if (ref->type == Type::unreachable ||
- (rtt && rtt->type == Type::unreachable)) {
+ if (ref->type == Type::unreachable) {
type = Type::unreachable;
} else {
type = Type::i32;
}
}
-HeapType RefTest::getIntendedType() {
- return rtt ? rtt->type.getHeapType() : intendedType;
-}
-
void RefCast::finalize() {
- if (ref->type == Type::unreachable ||
- (rtt && rtt->type == Type::unreachable)) {
+ if (ref->type == Type::unreachable) {
type = Type::unreachable;
} else {
// The output of ref.cast may be null if the input is null (in that case the
// null is passed through).
- type = Type(getIntendedType(), ref->type.getNullability());
+ type = Type(intendedType, ref->type.getNullability());
}
}
-HeapType RefCast::getIntendedType() {
- return rtt ? rtt->type.getHeapType() : intendedType;
-}
-
void BrOn::finalize() {
- if (ref->type == Type::unreachable ||
- (rtt && rtt->type == Type::unreachable)) {
+ if (ref->type == Type::unreachable) {
type = Type::unreachable;
return;
}
@@ -984,7 +973,7 @@ void BrOn::finalize() {
case BrOnCastFail:
// If we do not branch, the cast worked, and we have something of the cast
// type.
- type = Type(getIntendedType(), NonNullable);
+ type = Type(intendedType, NonNullable);
break;
case BrOnNonFunc:
type = Type(HeapType::func, NonNullable);
@@ -1000,11 +989,6 @@ void BrOn::finalize() {
}
}
-HeapType BrOn::getIntendedType() {
- assert(op == BrOnCast || op == BrOnCastFail);
- return rtt ? rtt->type.getHeapType() : intendedType;
-}
-
Type BrOn::getSentType() {
switch (op) {
case BrOnNull:
@@ -1022,7 +1006,7 @@ Type BrOn::getSentType() {
if (ref->type == Type::unreachable) {
return Type::unreachable;
}
- return Type(getIntendedType(), NonNullable);
+ return Type(intendedType, NonNullable);
case BrOnFunc:
return Type(HeapType::func, NonNullable);
case BrOnData:
@@ -1039,31 +1023,10 @@ Type BrOn::getSentType() {
}
}
-void RttCanon::finalize() {
- // Nothing to do - the type must have been set already during construction.
-}
-
-void RttSub::finalize() {
- if (parent->type == Type::unreachable) {
- type = Type::unreachable;
- }
- // Else nothing to do - the type must have been set already during
- // construction.
-}
-
void StructNew::finalize() {
- if (rtt && rtt->type == Type::unreachable) {
- type = Type::unreachable;
- return;
- }
if (handleUnreachableOperands(this)) {
return;
}
- // A dynamic StructNew infers the type from the rtt. A static one has the type
- // already in the type field.
- if (rtt) {
- type = Type(rtt->type.getHeapType(), NonNullable);
- }
}
void StructGet::finalize() {
@@ -1083,35 +1046,20 @@ void StructSet::finalize() {
}
void ArrayNew::finalize() {
- if ((rtt && rtt->type == Type::unreachable) ||
- size->type == Type::unreachable ||
+ if (size->type == Type::unreachable ||
(init && init->type == Type::unreachable)) {
type = Type::unreachable;
return;
}
- // A dynamic ArrayNew infers the type from the rtt. A static one has the type
- // already in the type field.
- if (rtt) {
- type = Type(rtt->type.getHeapType(), NonNullable);
- }
}
void ArrayInit::finalize() {
- if (rtt && rtt->type == Type::unreachable) {
- type = Type::unreachable;
- return;
- }
for (auto* value : values) {
if (value->type == Type::unreachable) {
type = Type::unreachable;
return;
}
}
- // A dynamic ArrayInit infers the type from the rtt. A static one has the type
- // already in the type field.
- if (rtt) {
- type = Type(rtt->type.getHeapType(), NonNullable);
- }
}
void ArrayGet::finalize() {