From e9e1b2ff00aeb05aaeb57af3811add267dc25323 Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Thu, 24 Sep 2020 12:02:09 +0200 Subject: 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. --- src/wasm-binary.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index df800d470..9ac5664d3 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -599,6 +599,7 @@ enum ASTNodes { // prefixes + GCPrefix = 0xfb, MiscPrefix = 0xfc, SIMDPrefix = 0xfd, AtomicPrefix = 0xfe, @@ -937,7 +938,13 @@ enum ASTNodes { Catch = 0x07, Throw = 0x08, Rethrow = 0x09, - BrOnExn = 0x0a + BrOnExn = 0x0a, + + // gc opcodes + + I31New = 0x20, + I31GetS = 0x21, + I31GetU = 0x22 }; enum MemoryAccess { @@ -1452,6 +1459,8 @@ public: bool maybeVisitDataDrop(Expression*& out, uint32_t code); bool maybeVisitMemoryCopy(Expression*& out, uint32_t code); bool maybeVisitMemoryFill(Expression*& out, uint32_t code); + bool maybeVisitI31New(Expression*& out, uint32_t code); + bool maybeVisitI31Get(Expression*& out, uint32_t code); void visitSelect(Select* curr, uint8_t code); void visitReturn(Return* curr); void visitMemorySize(MemorySize* curr); -- cgit v1.2.3