summaryrefslogtreecommitdiff
path: root/src/ir/global-utils.h
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-29 21:24:02 +0200
committerGitHub <noreply@github.com>2020-09-29 21:24:02 +0200
commita629dc27bcb8022fad559ecdb2d3138e39183c6b (patch)
tree29cc4eba73071759fce48295db2c97df758c17ab /src/ir/global-utils.h
parentfa4c884f4ebfde185c9d8a3ee4e54f96c57cebed (diff)
downloadbinaryen-a629dc27bcb8022fad559ecdb2d3138e39183c6b.tar.gz
binaryen-a629dc27bcb8022fad559ecdb2d3138e39183c6b.tar.bz2
binaryen-a629dc27bcb8022fad559ecdb2d3138e39183c6b.zip
GC: Fuzzing support for i31 (#3169)
Integrates `i31ref` types and instructions into the fuzzer, by assuming that `(i31.new (i32.const N))` is constant and hence suitable to be used in global initializers.
Diffstat (limited to 'src/ir/global-utils.h')
-rw-r--r--src/ir/global-utils.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/ir/global-utils.h b/src/ir/global-utils.h
index b575d6952..7dc4c6af3 100644
--- a/src/ir/global-utils.h
+++ b/src/ir/global-utils.h
@@ -56,15 +56,13 @@ getGlobalInitializedToImport(Module& wasm, Name module, Name base) {
inline bool canInitializeGlobal(const Expression* curr) {
if (auto* tuple = curr->dynCast<TupleMake>()) {
for (auto* op : tuple->operands) {
- if (!op->is<Const>() && !op->is<RefNull>() &&
- !op->is<RefFunc>() & !op->is<GlobalGet>()) {
+ if (!Properties::isSingleConstantExpression(op) && !op->is<GlobalGet>()) {
return false;
}
}
return true;
}
- return curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>() ||
- curr->is<GlobalGet>();
+ return Properties::isSingleConstantExpression(curr) || curr->is<GlobalGet>();
}
} // namespace GlobalUtils