@@ -85,7 +85,11 @@ fn exec_one(
8585 Nop => { /* do nothing */ }
8686 Unreachable => return Ok ( ExecResult :: Trap ( crate :: Trap :: Unreachable ) ) , // we don't need to include the call frame here because it's already on the stack
8787 Drop => stack. values . pop ( ) . map ( |_| ( ) ) ?,
88- Select => {
88+ Select ( t) => {
89+ if t. is_some ( ) {
90+ unimplemented ! ( "select with type" ) ;
91+ }
92+
8993 let cond: i32 = stack. values . pop ( ) ?. into ( ) ;
9094 let val2 = stack. values . pop ( ) ?;
9195
@@ -283,34 +287,34 @@ fn exec_one(
283287 F32Gt => comp ! ( >, f32 , stack) ,
284288 F64Gt => comp ! ( >, f64 , stack) ,
285289
286- I64Add => arithmetic ! ( + , i64 , stack) ,
287- I32Add => arithmetic ! ( + , i32 , stack) ,
288- F32Add => arithmetic ! ( +, f32 , stack) ,
289- F64Add => arithmetic ! ( +, f64 , stack) ,
290+ I64Add => arithmetic_method ! ( wrapping_add , i64 , stack) ,
291+ I32Add => arithmetic_method ! ( wrapping_add , i32 , stack) ,
292+ F32Add => arithmetic_op ! ( +, f32 , stack) ,
293+ F64Add => arithmetic_op ! ( +, f64 , stack) ,
290294
291- I32Sub => arithmetic ! ( - , i32 , stack) ,
292- I64Sub => arithmetic ! ( - , i64 , stack) ,
293- F32Sub => arithmetic ! ( -, f32 , stack) ,
294- F64Sub => arithmetic ! ( -, f64 , stack) ,
295+ I32Sub => arithmetic_method ! ( wrapping_sub , i32 , stack) ,
296+ I64Sub => arithmetic_method ! ( wrapping_sub , i64 , stack) ,
297+ F32Sub => arithmetic_op ! ( -, f32 , stack) ,
298+ F64Sub => arithmetic_op ! ( -, f64 , stack) ,
295299
296- F32Div => arithmetic ! ( /, f32 , stack) ,
297- F64Div => arithmetic ! ( /, f64 , stack) ,
300+ F32Div => arithmetic_op ! ( /, f32 , stack) ,
301+ F64Div => arithmetic_op ! ( /, f64 , stack) ,
298302
299- I32Mul => arithmetic ! ( * , i32 , stack) ,
300- I64Mul => arithmetic ! ( * , i64 , stack) ,
301- F32Mul => arithmetic ! ( * , f32 , stack) ,
302- F64Mul => arithmetic ! ( * , f64 , stack) ,
303+ I32Mul => arithmetic_method ! ( wrapping_mul , i32 , stack) ,
304+ I64Mul => arithmetic_method ! ( wrapping_mul , i64 , stack) ,
305+ F32Mul => arithmetic_op ! ( * , f32 , stack) ,
306+ F64Mul => arithmetic_op ! ( * , f64 , stack) ,
303307
304308 // these can trap
305- I32DivS => checked_arithmetic ! ( checked_div, i32 , stack, crate :: Trap :: DivisionByZero ) ,
306- I64DivS => checked_arithmetic ! ( checked_div, i64 , stack, crate :: Trap :: DivisionByZero ) ,
307- I32DivU => checked_arithmetic_cast ! ( checked_div, i32 , u32 , stack, crate :: Trap :: DivisionByZero ) ,
308- I64DivU => checked_arithmetic_cast ! ( checked_div, i64 , u64 , stack, crate :: Trap :: DivisionByZero ) ,
309-
310- I32RemS => checked_arithmetic ! ( checked_rem, i32 , stack, crate :: Trap :: DivisionByZero ) ,
311- I64RemS => checked_arithmetic ! ( checked_rem, i64 , stack, crate :: Trap :: DivisionByZero ) ,
312- I32RemU => checked_arithmetic_cast ! ( checked_rem, i32 , u32 , stack, crate :: Trap :: DivisionByZero ) ,
313- I64RemU => checked_arithmetic_cast ! ( checked_rem, i64 , u64 , stack, crate :: Trap :: DivisionByZero ) ,
309+ I32DivS => checked_arithmetic_method ! ( checked_div, i32 , stack, crate :: Trap :: DivisionByZero ) ,
310+ I64DivS => checked_arithmetic_method ! ( checked_div, i64 , stack, crate :: Trap :: DivisionByZero ) ,
311+ I32DivU => checked_arithmetic_method_cast ! ( checked_div, i32 , u32 , stack, crate :: Trap :: DivisionByZero ) ,
312+ I64DivU => checked_arithmetic_method_cast ! ( checked_div, i64 , u64 , stack, crate :: Trap :: DivisionByZero ) ,
313+
314+ I32RemS => checked_arithmetic_method ! ( checked_rem, i32 , stack, crate :: Trap :: DivisionByZero ) ,
315+ I64RemS => checked_arithmetic_method ! ( checked_rem, i64 , stack, crate :: Trap :: DivisionByZero ) ,
316+ I32RemU => checked_arithmetic_method_cast ! ( checked_rem, i32 , u32 , stack, crate :: Trap :: DivisionByZero ) ,
317+ I64RemU => checked_arithmetic_method_cast ! ( checked_rem, i64 , u64 , stack, crate :: Trap :: DivisionByZero ) ,
314318
315319 F32ConvertI32S => conv_1 ! ( i32 , f32 , stack) ,
316320 F32ConvertI64S => conv_1 ! ( i64 , f32 , stack) ,
0 commit comments