diff options
| author | Henry <mail@henrygressmann.de> | 2023-12-28 16:47:35 +0100 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2023-12-28 16:47:35 +0100 |
| commit | 28b8a556b51aecf9eaed92c1fc3e648e4efe7572 (patch) | |
| tree | 2628eab536c15839989d21b4ecfa6628de08ab22 /crates/parser | |
| parent | 1041182f6ed3376eb62f4269c41cb16a47ab8ad0 (diff) | |
chore: add ref instructions
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser')
| -rw-r--r-- | crates/parser/src/conversion.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/parser/src/conversion.rs b/crates/parser/src/conversion.rs index b962ff4..1b22af8 100644 --- a/crates/parser/src/conversion.rs +++ b/crates/parser/src/conversion.rs @@ -296,6 +296,9 @@ pub(crate) fn process_const_operators(ops: OperatorsReader) -> Result<ConstInstr pub fn process_const_operator(op: wasmparser::Operator) -> Result<ConstInstruction> { match op { + wasmparser::Operator::RefNull { ty } => Ok(ConstInstruction::RefNull(convert_valtype(&ty))), + wasmparser::Operator::RefFunc { function_index } => Ok(ConstInstruction::RefFunc(function_index)), + wasmparser::Operator::I32Const { value } => Ok(ConstInstruction::I32Const(value)), wasmparser::Operator::I64Const { value } => Ok(ConstInstruction::I64Const(value)), wasmparser::Operator::F32Const { value } => Ok(ConstInstruction::F32Const(f32::from_bits(value.bits()))), // TODO: check if this is correct @@ -414,12 +417,15 @@ pub fn process_operators<'a>( LocalTee { local_index } => Instruction::LocalTee(local_index), GlobalGet { global_index } => Instruction::GlobalGet(global_index), GlobalSet { global_index } => Instruction::GlobalSet(global_index), - MemorySize { .. } => Instruction::MemorySize, - MemoryGrow { .. } => Instruction::MemoryGrow, + MemorySize { mem, mem_byte } => Instruction::MemorySize(mem, mem_byte), + MemoryGrow { mem, mem_byte } => Instruction::MemoryGrow(mem, mem_byte), I32Const { value } => Instruction::I32Const(value), I64Const { value } => Instruction::I64Const(value), - F32Const { value } => Instruction::F32Const(f32::from_bits(value.bits())), // TODO: check if this is correct - F64Const { value } => Instruction::F64Const(f64::from_bits(value.bits())), // TODO: check if this is correct + F32Const { value } => Instruction::F32Const(f32::from_bits(value.bits())), + F64Const { value } => Instruction::F64Const(f64::from_bits(value.bits())), + RefNull { ty } => Instruction::RefNull(convert_valtype(&ty)), + RefIsNull => Instruction::RefIsNull, + RefFunc { function_index } => Instruction::RefFunc(function_index), I32Load { memarg } => Instruction::I32Load(convert_memarg(memarg)), I64Load { memarg } => Instruction::I64Load(convert_memarg(memarg)), F32Load { memarg } => Instruction::F32Load(convert_memarg(memarg)), @@ -580,10 +586,11 @@ pub fn process_operators<'a>( I64TruncSatF64S => Instruction::I64TruncSatF64S, I64TruncSatF64U => Instruction::I64TruncSatF64U, op => { + log::error!("Unsupported instruction: {:?}", op); return Err(crate::ParseError::UnsupportedOperator(format!( "Unsupported instruction: {:?}", op - ))) + ))); } }; |
