diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-29 21:24:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 21:24:02 +0200 |
commit | a629dc27bcb8022fad559ecdb2d3138e39183c6b (patch) | |
tree | 29cc4eba73071759fce48295db2c97df758c17ab /src/ir/global-utils.h | |
parent | fa4c884f4ebfde185c9d8a3ee4e54f96c57cebed (diff) | |
download | binaryen-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.h | 6 |
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 |