diff --git a/src/binary_reader.rs b/src/binary_reader.rs index dbe77631..81c24c39 100644 --- a/src/binary_reader.rs +++ b/src/binary_reader.rs @@ -894,19 +894,19 @@ impl<'a> BinaryReader<'a> { }, 0x1a => Operator::Drop, 0x1b => Operator::Select, - 0x20 => Operator::GetLocal { + 0x20 => Operator::LocalGet { local_index: self.read_var_u32()?, }, - 0x21 => Operator::SetLocal { + 0x21 => Operator::LocalSet { local_index: self.read_var_u32()?, }, - 0x22 => Operator::TeeLocal { + 0x22 => Operator::LocalTee { local_index: self.read_var_u32()?, }, - 0x23 => Operator::GetGlobal { + 0x23 => Operator::GlobalGet { global_index: self.read_var_u32()?, }, - 0x24 => Operator::SetGlobal { + 0x24 => Operator::GlobalSet { global_index: self.read_var_u32()?, }, 0x25 => Operator::TableGet { @@ -1101,25 +1101,25 @@ impl<'a> BinaryReader<'a> { 0xa5 => Operator::F64Max, 0xa6 => Operator::F64Copysign, 0xa7 => Operator::I32WrapI64, - 0xa8 => Operator::I32TruncSF32, - 0xa9 => Operator::I32TruncUF32, - 0xaa => Operator::I32TruncSF64, - 0xab => Operator::I32TruncUF64, - 0xac => Operator::I64ExtendSI32, - 0xad => Operator::I64ExtendUI32, - 0xae => Operator::I64TruncSF32, - 0xaf => Operator::I64TruncUF32, - 0xb0 => Operator::I64TruncSF64, - 0xb1 => Operator::I64TruncUF64, - 0xb2 => Operator::F32ConvertSI32, - 0xb3 => Operator::F32ConvertUI32, - 0xb4 => Operator::F32ConvertSI64, - 0xb5 => Operator::F32ConvertUI64, + 0xa8 => Operator::I32TruncF32S, + 0xa9 => Operator::I32TruncF32U, + 0xaa => Operator::I32TruncF64S, + 0xab => Operator::I32TruncF64U, + 0xac => Operator::I64ExtendI32S, + 0xad => Operator::I64ExtendI32U, + 0xae => Operator::I64TruncF32S, + 0xaf => Operator::I64TruncF32U, + 0xb0 => Operator::I64TruncF64S, + 0xb1 => Operator::I64TruncF64U, + 0xb2 => Operator::F32ConvertI32S, + 0xb3 => Operator::F32ConvertI32U, + 0xb4 => Operator::F32ConvertI64S, + 0xb5 => Operator::F32ConvertI64U, 0xb6 => Operator::F32DemoteF64, - 0xb7 => Operator::F64ConvertSI32, - 0xb8 => Operator::F64ConvertUI32, - 0xb9 => Operator::F64ConvertSI64, - 0xba => Operator::F64ConvertUI64, + 0xb7 => Operator::F64ConvertI32S, + 0xb8 => Operator::F64ConvertI32U, + 0xb9 => Operator::F64ConvertI64S, + 0xba => Operator::F64ConvertI64U, 0xbb => Operator::F64PromoteF32, 0xbc => Operator::I32ReinterpretF32, 0xbd => Operator::I64ReinterpretF64, @@ -1151,14 +1151,14 @@ impl<'a> BinaryReader<'a> { fn read_0xfc_operator(&mut self) -> Result> { let code = self.read_u8()? as u8; Ok(match code { - 0x00 => Operator::I32TruncSSatF32, - 0x01 => Operator::I32TruncUSatF32, - 0x02 => Operator::I32TruncSSatF64, - 0x03 => Operator::I32TruncUSatF64, - 0x04 => Operator::I64TruncSSatF32, - 0x05 => Operator::I64TruncUSatF32, - 0x06 => Operator::I64TruncSSatF64, - 0x07 => Operator::I64TruncUSatF64, + 0x00 => Operator::I32TruncSatF32S, + 0x01 => Operator::I32TruncSatF32U, + 0x02 => Operator::I32TruncSatF64S, + 0x03 => Operator::I32TruncSatF64U, + 0x04 => Operator::I64TruncSatF32S, + 0x05 => Operator::I64TruncSatF32U, + 0x06 => Operator::I64TruncSatF64S, + 0x07 => Operator::I64TruncSatF64U, 0x08 => { let segment = self.read_var_u32()?; diff --git a/src/operators_validator.rs b/src/operators_validator.rs index 506bad9b..b02a6a3f 100644 --- a/src/operators_validator.rs +++ b/src/operators_validator.rs @@ -760,14 +760,14 @@ impl OperatorValidator { let ty = self.check_select()?; self.func_state.change_frame_after_select(ty)?; } - Operator::GetLocal { local_index } => { + Operator::LocalGet { local_index } => { if local_index as usize >= self.func_state.local_types.len() { return Err("local index out of bounds"); } let local_type = self.func_state.local_types[local_index as usize]; self.func_state.change_frame_with_type(0, local_type)?; } - Operator::SetLocal { local_index } => { + Operator::LocalSet { local_index } => { if local_index as usize >= self.func_state.local_types.len() { return Err("local index out of bounds"); } @@ -775,7 +775,7 @@ impl OperatorValidator { self.check_operands_1(local_type)?; self.func_state.change_frame(1)?; } - Operator::TeeLocal { local_index } => { + Operator::LocalTee { local_index } => { if local_index as usize >= self.func_state.local_types.len() { return Err("local index out of bounds"); } @@ -783,14 +783,14 @@ impl OperatorValidator { self.check_operands_1(local_type)?; self.func_state.change_frame_with_type(1, local_type)?; } - Operator::GetGlobal { global_index } => { + Operator::GlobalGet { global_index } => { if global_index as usize >= resources.globals().len() { return Err("global index out of bounds"); } let ty = &resources.globals()[global_index as usize]; self.func_state.change_frame_with_type(0, ty.content_type)?; } - Operator::SetGlobal { global_index } => { + Operator::GlobalSet { global_index } => { if global_index as usize >= resources.globals().len() { return Err("global index out of bounds"); } @@ -1089,32 +1089,32 @@ impl OperatorValidator { self.check_operands_1(Type::I64)?; self.func_state.change_frame_with_type(1, Type::I32)?; } - Operator::I32TruncSF32 | Operator::I32TruncUF32 => { + Operator::I32TruncF32S | Operator::I32TruncF32U => { self.check_operands_1(Type::F32)?; self.func_state.change_frame_with_type(1, Type::I32)?; } - Operator::I32TruncSF64 | Operator::I32TruncUF64 => { + Operator::I32TruncF64S | Operator::I32TruncF64U => { self.check_operands_1(Type::F64)?; self.func_state.change_frame_with_type(1, Type::I32)?; } - Operator::I64ExtendSI32 | Operator::I64ExtendUI32 => { + Operator::I64ExtendI32S | Operator::I64ExtendI32U => { self.check_operands_1(Type::I32)?; self.func_state.change_frame_with_type(1, Type::I64)?; } - Operator::I64TruncSF32 | Operator::I64TruncUF32 => { + Operator::I64TruncF32S | Operator::I64TruncF32U => { self.check_operands_1(Type::F32)?; self.func_state.change_frame_with_type(1, Type::I64)?; } - Operator::I64TruncSF64 | Operator::I64TruncUF64 => { + Operator::I64TruncF64S | Operator::I64TruncF64U => { self.check_operands_1(Type::F64)?; self.func_state.change_frame_with_type(1, Type::I64)?; } - Operator::F32ConvertSI32 | Operator::F32ConvertUI32 => { + Operator::F32ConvertI32S | Operator::F32ConvertI32U => { self.check_non_deterministic_enabled()?; self.check_operands_1(Type::I32)?; self.func_state.change_frame_with_type(1, Type::F32)?; } - Operator::F32ConvertSI64 | Operator::F32ConvertUI64 => { + Operator::F32ConvertI64S | Operator::F32ConvertI64U => { self.check_non_deterministic_enabled()?; self.check_operands_1(Type::I64)?; self.func_state.change_frame_with_type(1, Type::F32)?; @@ -1124,12 +1124,12 @@ impl OperatorValidator { self.check_operands_1(Type::F64)?; self.func_state.change_frame_with_type(1, Type::F32)?; } - Operator::F64ConvertSI32 | Operator::F64ConvertUI32 => { + Operator::F64ConvertI32S | Operator::F64ConvertI32U => { self.check_non_deterministic_enabled()?; self.check_operands_1(Type::I32)?; self.func_state.change_frame_with_type(1, Type::F64)?; } - Operator::F64ConvertSI64 | Operator::F64ConvertUI64 => { + Operator::F64ConvertI64S | Operator::F64ConvertI64U => { self.check_non_deterministic_enabled()?; self.check_operands_1(Type::I64)?; self.func_state.change_frame_with_type(1, Type::F64)?; @@ -1157,19 +1157,19 @@ impl OperatorValidator { self.check_operands_1(Type::I64)?; self.func_state.change_frame_with_type(1, Type::F64)?; } - Operator::I32TruncSSatF32 | Operator::I32TruncUSatF32 => { + Operator::I32TruncSatF32S | Operator::I32TruncSatF32U => { self.check_operands_1(Type::F32)?; self.func_state.change_frame_with_type(1, Type::I32)?; } - Operator::I32TruncSSatF64 | Operator::I32TruncUSatF64 => { + Operator::I32TruncSatF64S | Operator::I32TruncSatF64U => { self.check_operands_1(Type::F64)?; self.func_state.change_frame_with_type(1, Type::I32)?; } - Operator::I64TruncSSatF32 | Operator::I64TruncUSatF32 => { + Operator::I64TruncSatF32S | Operator::I64TruncSatF32U => { self.check_operands_1(Type::F32)?; self.func_state.change_frame_with_type(1, Type::I64)?; } - Operator::I64TruncSSatF64 | Operator::I64TruncUSatF64 => { + Operator::I64TruncSatF64S | Operator::I64TruncSatF64U => { self.check_operands_1(Type::F64)?; self.func_state.change_frame_with_type(1, Type::I64)?; } diff --git a/src/primitives.rs b/src/primitives.rs index 1bb8db6d..db8d243a 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -250,11 +250,11 @@ pub enum Operator<'a> { CallIndirect { index: u32, table_index: u32 }, Drop, Select, - GetLocal { local_index: u32 }, - SetLocal { local_index: u32 }, - TeeLocal { local_index: u32 }, - GetGlobal { global_index: u32 }, - SetGlobal { global_index: u32 }, + LocalGet { local_index: u32 }, + LocalSet { local_index: u32 }, + LocalTee { local_index: u32 }, + GlobalGet { global_index: u32 }, + GlobalSet { global_index: u32 }, I32Load { memarg: MemoryImmediate }, I64Load { memarg: MemoryImmediate }, F32Load { memarg: MemoryImmediate }, @@ -385,25 +385,25 @@ pub enum Operator<'a> { F64Max, F64Copysign, I32WrapI64, - I32TruncSF32, - I32TruncUF32, - I32TruncSF64, - I32TruncUF64, - I64ExtendSI32, - I64ExtendUI32, - I64TruncSF32, - I64TruncUF32, - I64TruncSF64, - I64TruncUF64, - F32ConvertSI32, - F32ConvertUI32, - F32ConvertSI64, - F32ConvertUI64, + I32TruncF32S, + I32TruncF32U, + I32TruncF64S, + I32TruncF64U, + I64ExtendI32S, + I64ExtendI32U, + I64TruncF32S, + I64TruncF32U, + I64TruncF64S, + I64TruncF64U, + F32ConvertI32S, + F32ConvertI32U, + F32ConvertI64S, + F32ConvertI64U, F32DemoteF64, - F64ConvertSI32, - F64ConvertUI32, - F64ConvertSI64, - F64ConvertUI64, + F64ConvertI32S, + F64ConvertI32U, + F64ConvertI64S, + F64ConvertI64U, F64PromoteF32, I32ReinterpretF32, I64ReinterpretF64, @@ -417,14 +417,14 @@ pub enum Operator<'a> { // 0xFC operators // Non-trapping Float-to-int Conversions - I32TruncSSatF32, - I32TruncUSatF32, - I32TruncSSatF64, - I32TruncUSatF64, - I64TruncSSatF32, - I64TruncUSatF32, - I64TruncSSatF64, - I64TruncUSatF64, + I32TruncSatF32S, + I32TruncSatF32U, + I32TruncSatF64S, + I32TruncSatF64U, + I64TruncSatF32S, + I64TruncSatF32U, + I64TruncSatF64S, + I64TruncSatF64U, // 0xFC operators // bulk memory https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md diff --git a/src/validator.rs b/src/validator.rs index b84ae69b..9c09db25 100644 --- a/src/validator.rs +++ b/src/validator.rs @@ -319,7 +319,7 @@ impl<'a> ValidatingParser<'a> { } Type::V128 } - Operator::GetGlobal { global_index } => { + Operator::GlobalGet { global_index } => { if global_index as usize >= state.global_count { return self.create_error("init_expr global index out of bounds"); }