From dce1fe8c16559437cae05c0dd782237474ca6082 Mon Sep 17 00:00:00 2001 From: Jay Phelps Date: Tue, 20 Aug 2019 15:27:58 -0500 Subject: Add initial support for anyref as an opaque type (#2294) Another round of trying to push upstream things from my fork. This PR only adds support for anyref itself as an opaque type. It does NOT implement the full [reference types proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)--so no table.get/set/grow/etc or ref.null, ref.func, etc. Figured it was easier to review and merge as we go, especially if I did something fundamentally wrong. *** I did put it under the `--enable-reference-types` flag as I imagine that even though this PR doesn't complete the full feature set, it probably is the right home. Lmk if not. I'll also be adding a few github comments to places I want to point out/question. --- src/wasm-binary.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 1efa24b48..d01502e9b 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -381,7 +381,9 @@ enum EncodedType { v128 = -0x5, // 0x7b // elem_type AnyFunc = -0x10, // 0x70 - // reference type + // opaque reference type + anyref = -0x11, // 0x6f + // exception reference type exnref = -0x18, // 0x68 // func_type form Func = -0x20, // 0x60 @@ -406,6 +408,7 @@ extern const char* SignExtFeature; extern const char* SIMD128Feature; extern const char* ExceptionHandlingFeature; extern const char* TailCallFeature; +extern const char* ReferenceTypesFeature; enum Subsection { NameFunction = 1, @@ -903,6 +906,9 @@ inline S32LEB binaryType(Type type) { case v128: ret = BinaryConsts::EncodedType::v128; break; + case anyref: + ret = BinaryConsts::EncodedType::anyref; + break; case exnref: ret = BinaryConsts::EncodedType::exnref; break; -- cgit v1.2.3