summaryrefslogtreecommitdiff
path: root/src/passes/Asyncify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/Asyncify.cpp')
-rw-r--r--src/passes/Asyncify.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/passes/Asyncify.cpp b/src/passes/Asyncify.cpp
index dc2ebd4d4..5b96d6e86 100644
--- a/src/passes/Asyncify.cpp
+++ b/src/passes/Asyncify.cpp
@@ -1302,7 +1302,7 @@ private:
if (!relevantLiveLocals.count(i)) {
continue;
}
- total += func->getLocalType(i).getByteSize();
+ total += getByteSize(func->getLocalType(i));
}
auto* block = builder->makeBlock();
block->list.push_back(builder->makeIncStackPos(-total));
@@ -1317,7 +1317,7 @@ private:
auto localType = func->getLocalType(i);
SmallVector<Expression*, 1> loads;
for (const auto& type : localType) {
- auto size = type.getByteSize();
+ auto size = getByteSize(type);
assert(size % STACK_ALIGN == 0);
// TODO: higher alignment?
loads.push_back(
@@ -1361,7 +1361,7 @@ private:
auto localType = func->getLocalType(i);
size_t j = 0;
for (const auto& type : localType) {
- auto size = type.getByteSize();
+ auto size = getByteSize(type);
Expression* localGet = builder->makeLocalGet(i, localType);
if (localType.size() > 1) {
localGet = builder->makeTupleExtract(localGet, j);
@@ -1395,6 +1395,15 @@ private:
Type::i32),
builder->makeIncStackPos(4));
}
+
+ unsigned getByteSize(Type type) {
+ if (!type.hasByteSize()) {
+ Fatal() << "Asyncify does not yet support non-number types, like "
+ "references (see "
+ "https://github.com/WebAssembly/binaryen/issues/3739)";
+ }
+ return type.getByteSize();
+ }
};
} // anonymous namespace