diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-24 12:02:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-24 12:02:09 +0200 |
commit | e9e1b2ff00aeb05aaeb57af3811add267dc25323 (patch) | |
tree | 4e19032813858b2e650f0cda46fe9fa227aa0a7f /test/example/c-api-kitchen-sink.c | |
parent | a42423fafa8cf731c69303ddc0acbe80c890e0ab (diff) | |
download | binaryen-e9e1b2ff00aeb05aaeb57af3811add267dc25323.tar.gz binaryen-e9e1b2ff00aeb05aaeb57af3811add267dc25323.tar.bz2 binaryen-e9e1b2ff00aeb05aaeb57af3811add267dc25323.zip |
GC: Add i31 instructions (#3154)
Adds the `i31.new` and `i31.get_s/u` instructions for creating and working with `i31ref` typed values. Does not include fuzzer integration just yet because the fuzzer expects that trivial values it creates are suitable in global initializers, which is not the case for trivial `i31ref` expressions.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 09a6897eb..118fcb3f3 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -312,6 +312,7 @@ void test_core() { BinaryenExpressionRef funcrefExpr = BinaryenRefNull(module, BinaryenTypeFuncref()); funcrefExpr = BinaryenRefFunc(module, "kitchen()sinker"); BinaryenExpressionRef exnrefExpr = BinaryenRefNull(module, BinaryenTypeExnref()); + BinaryenExpressionRef i31refExpr = BinaryenI31New(module, makeInt32(module, 1)); // Events BinaryenAddEvent( @@ -776,6 +777,10 @@ void test_core() { // Memory BinaryenMemorySize(module), BinaryenMemoryGrow(module, makeInt32(module, 0)), + // GC + BinaryenI31New(module, makeInt32(module, 0)), + BinaryenI31Get(module, i31refExpr, 1), + BinaryenI31Get(module, BinaryenI31New(module, makeInt32(module, 2)), 0), // Other BinaryenNop(module), BinaryenUnreachable(module), |