From 4d3d801ef470570250c415d5358639a5b2fe1963 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Mon, 17 Jul 2023 08:54:30 -0500 Subject: [PATCH] Update to new GC cast instruction encoding --- crates/wast/src/core/binary.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/wast/src/core/binary.rs b/crates/wast/src/core/binary.rs index 507ef330e1..4556fcb398 100644 --- a/crates/wast/src/core/binary.rs +++ b/crates/wast/src/core/binary.rs @@ -1173,7 +1173,7 @@ impl Encode for RefCast<'_> { } } -fn br_on_cast_flags(on_fail: bool, from_nullable: bool, to_nullable: bool) -> u8 { +fn br_on_cast_flags(from_nullable: bool, to_nullable: bool) -> u8 { let mut flag = 0; if from_nullable { flag |= 1 << 0; @@ -1181,18 +1181,14 @@ fn br_on_cast_flags(on_fail: bool, from_nullable: bool, to_nullable: bool) -> u8 if to_nullable { flag |= 1 << 1; } - if on_fail { - flag |= 1 << 2; - } flag } impl Encode for BrOnCast<'_> { fn encode(&self, e: &mut Vec) { e.push(0xfb); - e.push(0x4f); + e.push(0x4e); e.push(br_on_cast_flags( - false, self.from_type.nullable, self.to_type.nullable, )); @@ -1207,7 +1203,6 @@ impl Encode for BrOnCastFail<'_> { e.push(0xfb); e.push(0x4f); e.push(br_on_cast_flags( - true, self.from_type.nullable, self.to_type.nullable, ));