diff options
author | Thomas Lively <tlively@google.com> | 2023-01-12 17:29:40 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 15:29:40 -0800 |
commit | cbd041088496fd41d19083729a727d97fb23504a (patch) | |
tree | 5f4bdbb958dc72fad1d88c71c9826a2e57a871fb /src/tools/fuzzing/fuzzing.cpp | |
parent | 0cbbcc2b24dd30777c5b92d6840e3ecdfeeab023 (diff) | |
download | binaryen-cbd041088496fd41d19083729a727d97fb23504a.tar.gz binaryen-cbd041088496fd41d19083729a727d97fb23504a.tar.bz2 binaryen-cbd041088496fd41d19083729a727d97fb23504a.zip |
[Wasm GC] Support and fuzz function subtyping (#5420)
Support function subtyping with contravariant parameters and covariant results.
The actual change is a single line in wasm-type.cpp, so most of the patch is
updating the type fuzzer to generate interesting function subtypes. Since
function parameters are covariant, generating a function subtype requires
generating supertypes of its parameter types, which required new functionality
in the fuzzer. Also update the fuzzer to choose to reuse types at a finer grain,
so for example individual function parameters or results might be reused
unmodified while other parameters or results are still modified.
Diffstat (limited to 'src/tools/fuzzing/fuzzing.cpp')
-rw-r--r-- | src/tools/fuzzing/fuzzing.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index 98f9ea733..d91266d49 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -1967,7 +1967,7 @@ Expression* TranslateToFuzzReader::makeRefFuncConst(Type type) { } // TODO: randomize the order for (auto& func : wasm.functions) { - if (Type::isSubType(type, Type(func->type, NonNullable))) { + if (Type::isSubType(Type(func->type, NonNullable), type)) { return builder.makeRefFunc(func->name, func->type); } } |