diff --git a/compiler/codegen/src/compile.rs b/compiler/codegen/src/compile.rs index b2a0796fa24..67a93b4650a 100644 --- a/compiler/codegen/src/compile.rs +++ b/compiler/codegen/src/compile.rs @@ -2027,7 +2027,7 @@ impl Compiler { // We cannot handle this exception type: emit!( self, - Instruction::JumpIfFalse { + Instruction::PopJumpIfFalse { target: next_handler, } ); @@ -3117,7 +3117,7 @@ impl Compiler { JumpOp::PopJumpIfFalse => { emit!( self, - Instruction::JumpIfFalse { + Instruction::PopJumpIfFalse { target: pc.fail_pop[pops] } ); @@ -4398,14 +4398,14 @@ impl Compiler { if condition { emit!( self, - Instruction::JumpIfTrue { + Instruction::PopJumpIfTrue { target: target_block, } ); } else { emit!( self, - Instruction::JumpIfFalse { + Instruction::PopJumpIfFalse { target: target_block, } ); diff --git a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ands.snap b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ands.snap index cf6223be1fb..8b2907ef6ff 100644 --- a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ands.snap +++ b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ands.snap @@ -3,10 +3,10 @@ source: compiler/codegen/src/compile.rs expression: "compile_exec(\"\\\nif True and False and False:\n pass\n\")" --- 1 0 LoadConst (True) - 1 JumpIfFalse (6) + 1 PopJumpIfFalse (6) 2 LoadConst (False) - 3 JumpIfFalse (6) + 3 PopJumpIfFalse (6) 4 LoadConst (False) - 5 JumpIfFalse (6) + 5 PopJumpIfFalse (6) 2 >> 6 ReturnConst (None) diff --git a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_mixed.snap b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_mixed.snap index 332d0fa985c..fc91a74283b 100644 --- a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_mixed.snap +++ b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_mixed.snap @@ -3,12 +3,12 @@ source: compiler/codegen/src/compile.rs expression: "compile_exec(\"\\\nif (True and False) or (False and True):\n pass\n\")" --- 1 0 LoadConst (True) - 1 JumpIfFalse (4) + 1 PopJumpIfFalse (4) 2 LoadConst (False) - 3 JumpIfTrue (8) + 3 PopJumpIfTrue (8) >> 4 LoadConst (False) - 5 JumpIfFalse (8) + 5 PopJumpIfFalse (8) 6 LoadConst (True) - 7 JumpIfFalse (8) + 7 PopJumpIfFalse (8) 2 >> 8 ReturnConst (None) diff --git a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ors.snap b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ors.snap index d4a4d8f2c5a..9be7c2af7bd 100644 --- a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ors.snap +++ b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__if_ors.snap @@ -3,10 +3,10 @@ source: compiler/codegen/src/compile.rs expression: "compile_exec(\"\\\nif True or False or False:\n pass\n\")" --- 1 0 LoadConst (True) - 1 JumpIfTrue (6) + 1 PopJumpIfTrue (6) 2 LoadConst (False) - 3 JumpIfTrue (6) + 3 PopJumpIfTrue (6) 4 LoadConst (False) - 5 JumpIfFalse (6) + 5 PopJumpIfFalse (6) 2 >> 6 ReturnConst (None) diff --git a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__nested_double_async_with.snap b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__nested_double_async_with.snap index 9165a6cfbf1..82c02d5ea34 100644 --- a/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__nested_double_async_with.snap +++ b/compiler/codegen/src/snapshots/rustpython_codegen__compile__tests__nested_double_async_with.snap @@ -53,7 +53,7 @@ expression: "compile_exec(\"\\\nfor stop_exc in (StopIteration('spam'), StopAsyn 6 43 LoadNameAny (7, Exception) 44 TestOperation (ExceptionMatch) - 45 JumpIfFalse (58) + 45 PopJumpIfFalse (58) 46 StoreLocal (8, ex) 7 47 LoadNameAny (3, self) diff --git a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ands.snap b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ands.snap index d80f10dfee5..bc88cf2349c 100644 --- a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ands.snap +++ b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ands.snap @@ -3,11 +3,11 @@ source: compiler/src/compile.rs expression: "compile_exec(\"\\\nif True and False and False:\n pass\n\")" --- 1 0 LoadConst (True) - 1 JumpIfFalse (6) + 1 PopJumpIfFalse (6) 2 LoadConst (False) - 3 JumpIfFalse (6) + 3 PopJumpIfFalse (6) 4 LoadConst (False) - 5 JumpIfFalse (6) + 5 PopJumpIfFalse (6) 2 >> 6 LoadConst (None) 7 ReturnValue diff --git a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_mixed.snap b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_mixed.snap index 0a9175bb12e..b19cbb119d9 100644 --- a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_mixed.snap +++ b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_mixed.snap @@ -3,13 +3,13 @@ source: compiler/src/compile.rs expression: "compile_exec(\"\\\nif (True and False) or (False and True):\n pass\n\")" --- 1 0 LoadConst (True) - 1 JumpIfFalse (4) + 1 PopJumpIfFalse (4) 2 LoadConst (False) - 3 JumpIfTrue (8) + 3 PopJumpIfTrue (8) >> 4 LoadConst (False) - 5 JumpIfFalse (8) + 5 PopJumpIfFalse (8) 6 LoadConst (True) - 7 JumpIfFalse (8) + 7 PopJumpIfFalse (8) 2 >> 8 LoadConst (None) 9 ReturnValue diff --git a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ors.snap b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ors.snap index 4b812639b2c..3d1f5a1d6f0 100644 --- a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ors.snap +++ b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__if_ors.snap @@ -3,11 +3,11 @@ source: compiler/src/compile.rs expression: "compile_exec(\"\\\nif True or False or False:\n pass\n\")" --- 1 0 LoadConst (True) - 1 JumpIfTrue (6) + 1 PopJumpIfTrue (6) 2 LoadConst (False) - 3 JumpIfTrue (6) + 3 PopJumpIfTrue (6) 4 LoadConst (False) - 5 JumpIfFalse (6) + 5 PopJumpIfFalse (6) 2 >> 6 LoadConst (None) 7 ReturnValue diff --git a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__nested_double_async_with.snap b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__nested_double_async_with.snap index 79a1a86ad1b..589f3210cfa 100644 --- a/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__nested_double_async_with.snap +++ b/compiler/codegen/src/snapshots/rustpython_compiler_core__compile__tests__nested_double_async_with.snap @@ -51,7 +51,7 @@ expression: "compile_exec(\"\\\nfor stop_exc in (StopIteration('spam'), StopAsyn 6 41 LoadNameAny (7, Exception) 42 TestOperation (ExceptionMatch) - 43 JumpIfFalse (53) + 43 PopJumpIfFalse (53) 44 StoreLocal (8, ex) 7 45 LoadNameAny (3, self) diff --git a/compiler/core/src/bytecode.rs b/compiler/core/src/bytecode.rs index 6400dec34b4..b38c5995085 100644 --- a/compiler/core/src/bytecode.rs +++ b/compiler/core/src/bytecode.rs @@ -525,7 +525,7 @@ pub enum Instruction { Swap { index: Arg, }, - // ToBool, + ToBool, Rotate2, Rotate3, Duplicate, @@ -548,11 +548,11 @@ pub enum Instruction { target: Arg