diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-19 08:48:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 08:48:06 +0200 |
commit | e35cdb97adf6eb2ade2be7734d1c6c397d440dc1 (patch) | |
tree | 7a740e6fc54d286a05ca3e746ae1e7f3c4b783a8 /test/example | |
parent | e308db569ab2582d3b0ea9accdbaa3b27abdb044 (diff) | |
download | binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.tar.gz binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.tar.bz2 binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.zip |
GC: Integrate eqref and i31ref types (#3141)
Adds the `eqref` and `i31ref` types to their respective code locations. Implements what can be implemented trivially and otherwise traps with a TODO for now. Integration of `eqref` is mostly complete due to it being nullable, just like `anyref`, but `i31ref` needs to remain disabled in the fuzzer because we are lacking the functionality to create trivial `i31ref` values, i.e. `(i31.new (i32.const 0))`, which is left for follow-ups to implement.
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 12 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 2 | ||||
-rw-r--r-- | test/example/typeinfo.txt | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index f619e6db5..442394e12 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -217,6 +217,18 @@ void test_types() { BinaryenTypeExpand(anyref, &valueType); assert(valueType == anyref); + BinaryenType eqref = BinaryenTypeEqref(); + printf(" // BinaryenTypeEqref: %d\n", eqref); + assert(BinaryenTypeArity(eqref) == 1); + BinaryenTypeExpand(eqref, &valueType); + assert(valueType == eqref); + + BinaryenType i31ref = BinaryenTypeI31ref(); + printf(" // BinaryenTypeI31ref: %d\n", i31ref); + assert(BinaryenTypeArity(i31ref) == 1); + BinaryenTypeExpand(i31ref, &valueType); + assert(valueType == i31ref); + printf(" // BinaryenTypeAuto: %d\n", BinaryenTypeAuto()); BinaryenType pair[] = {i32, i32}; diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 807730e27..405848140 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -9,6 +9,8 @@ // BinaryenTypeExternref: 8 // BinaryenTypeExnref: 9 // BinaryenTypeAnyref: 10 + // BinaryenTypeEqref: 11 + // BinaryenTypeI31ref: 12 // BinaryenTypeAuto: -1 BinaryenFeatureMVP: 0 BinaryenFeatureAtomics: 1 diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt index 539f305db..4ba628925 100644 --- a/test/example/typeinfo.txt +++ b/test/example/typeinfo.txt @@ -9,11 +9,11 @@ any anyref (ref any) eq -(ref null eq) +eqref (ref eq) i31 (ref null i31) -(ref i31) +i31ref exn exnref (ref exn) |