summaryrefslogtreecommitdiff
path: root/test/example/c-api-kitchen-sink.c
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-24 12:02:09 +0200
committerGitHub <noreply@github.com>2020-09-24 12:02:09 +0200
commite9e1b2ff00aeb05aaeb57af3811add267dc25323 (patch)
tree4e19032813858b2e650f0cda46fe9fa227aa0a7f /test/example/c-api-kitchen-sink.c
parenta42423fafa8cf731c69303ddc0acbe80c890e0ab (diff)
downloadbinaryen-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.c5
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),