From de19ba8e13deb5470b823b9705a825d041f997b1 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Fri, 24 Jan 2020 17:15:46 +0000 Subject: [PATCH] Bug 1574865 - Wasm: Update encoding of nullref to match proposal. r=lth This commit updates the encoding of nullref to match the one given in the reference types proposal. Spec: https://github.com/WebAssembly/reference-types/pull/66 Differential Revision: https://phabricator.services.mozilla.com/D58882 --- js/src/jit-test/lib/wasm-binary.js | 2 +- js/src/wasm/WasmConstants.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/src/jit-test/lib/wasm-binary.js b/js/src/jit-test/lib/wasm-binary.js index a90dec5ddbd0f..c069535b62064 100644 --- a/js/src/jit-test/lib/wasm-binary.js +++ b/js/src/jit-test/lib/wasm-binary.js @@ -41,7 +41,7 @@ const F32Code = 0x7d; const F64Code = 0x7c; const AnyFuncCode = 0x70; const AnyrefCode = 0x6f; -const RefCode = 0x6e; +const RefCode = 0x6d; const FuncCode = 0x60; const VoidCode = 0x40; diff --git a/js/src/wasm/WasmConstants.h b/js/src/wasm/WasmConstants.h index fe49cf78154b8..4c2600f5b3f3d 100644 --- a/js/src/wasm/WasmConstants.h +++ b/js/src/wasm/WasmConstants.h @@ -62,10 +62,13 @@ enum class TypeCode { FuncRef = 0x70, // SLEB128(-0x10) // A reference to any type. - AnyRef = 0x6f, + AnyRef = 0x6f, // SLEB128(-0x11) + + // A null reference. + NullRef = 0x6e, // SLEB128(-0x12) // Type constructor for reference types. - Ref = 0x6e, + Ref = 0x6d, // Type constructor for function types Func = 0x60, // SLEB128(-0x20) @@ -76,9 +79,6 @@ enum class TypeCode { // The 'empty' case of blocktype. BlockVoid = 0x40, // SLEB128(-0x40) - // Type designator for null - unofficial, will not appear in the binary format - NullRef = 0x39, - Limit = 0x80 };