diff options
author | Alon Zakai <azakai@google.com> | 2021-01-11 21:11:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 13:11:03 -0800 |
commit | eadb53c442209962f98dde22f3b769c691398cad (patch) | |
tree | bb7362dc6195a2bc058709e1a2b302cd49f6a9db /test/example | |
parent | fa3a74351be3c9903a95cff45dc8f903e1017461 (diff) | |
download | binaryen-eadb53c442209962f98dde22f3b769c691398cad.tar.gz binaryen-eadb53c442209962f98dde22f3b769c691398cad.tar.bz2 binaryen-eadb53c442209962f98dde22f3b769c691398cad.zip |
[GC] More HeapType instead of Type (#3475)
To handle both nullable and non-nullable i31s and other heap types, we cannot
just look at the isBasic case (which is just one of the two).
This may fix this issue on the release builder:
https://github.com/WebAssembly/binaryen/runs/1669944081?check_suite_focus=true
but the issue does not reproduce locally, so I worry it is something else...
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/cpp-unit.cpp | 14 | ||||
-rw-r--r-- | test/example/cpp-unit.txt | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/example/cpp-unit.cpp b/test/example/cpp-unit.cpp index 2aedfd441..9552473ce 100644 --- a/test/example/cpp-unit.cpp +++ b/test/example/cpp-unit.cpp @@ -556,10 +556,24 @@ void test_effects() { assert_equal(EffectAnalyzer(options, features, &nop).trap, false); } +void test_literals() { + // The i31 heap type may or may not be basic, depending on if it is nullable. + // Verify we handle both code paths. + { + Literal x(Type(HeapType::i31, Nullable)); + std::cout << x << '\n'; + } + { + Literal x(Type(HeapType::i31, NonNullable)); + std::cout << x << '\n'; + } +} + int main() { test_bits(); test_cost(); test_effects(); + test_literals(); if (failsCount > 0) { abort(); diff --git a/test/example/cpp-unit.txt b/test/example/cpp-unit.txt index 35821117c..cbe80e119 100644 --- a/test/example/cpp-unit.txt +++ b/test/example/cpp-unit.txt @@ -1 +1,3 @@ +i31ref(0) +i31ref(0) Success |