chore(tvix/eval): debug_assert that all jumps are patched
Suggestion from sterni in cl/6282 Change-Id: I1adbdda9ff74f55a2f72892ffa524808b305f403 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6445 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
		
							parent
							
								
									abdfa7459e
								
							
						
					
					
						commit
						8fdb67847c
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -342,22 +342,26 @@ impl VM { | |||
|                 OpCode::OpInterpolate(Count(count)) => self.run_interpolate(count)?, | ||||
| 
 | ||||
|                 OpCode::OpJump(JumpOffset(offset)) => { | ||||
|                     debug_assert!(offset != 0); | ||||
|                     self.frame_mut().ip += offset; | ||||
|                 } | ||||
| 
 | ||||
|                 OpCode::OpJumpIfTrue(JumpOffset(offset)) => { | ||||
|                     debug_assert!(offset != 0); | ||||
|                     if fallible!(self, self.peek(0).as_bool()) { | ||||
|                         self.frame_mut().ip += offset; | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 OpCode::OpJumpIfFalse(JumpOffset(offset)) => { | ||||
|                     debug_assert!(offset != 0); | ||||
|                     if !fallible!(self, self.peek(0).as_bool()) { | ||||
|                         self.frame_mut().ip += offset; | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 OpCode::OpJumpIfNotFound(JumpOffset(offset)) => { | ||||
|                     debug_assert!(offset != 0); | ||||
|                     if matches!(self.peek(0), Value::AttrNotFound) { | ||||
|                         self.pop(); | ||||
|                         self.frame_mut().ip += offset; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue