Starts or resumes execution of `image`. Panics if the processor state is out of sync with `image` or if the contents of `image` are invalid. We assume that the image comes from the result of an in-process compilation (not stored bytecode) and that the compiler guarantees that the image is valid.
(&mut self, image: &Image, heap: &mut Heap)
| 400 | /// are invalid. We assume that the image comes from the result of an in-process compilation |
| 401 | /// (not stored bytecode) and that the compiler guarantees that the image is valid. |
| 402 | pub(super) fn exec(&mut self, image: &Image, heap: &mut Heap) -> InternalStopReason { |
| 403 | while self.stop.is_none() { |
| 404 | if self.yield_pending && image.debug_info.instrs[self.pc].is_stmt_start { |
| 405 | self.yield_pending = false; |
| 406 | self.stop = Some(InternalStopReason::Yield); |
| 407 | continue; |
| 408 | } |
| 409 | |
| 410 | let instr = image.code[self.pc]; |
| 411 | |
| 412 | match opcode_of(instr) { |
| 413 | Opcode::AddDouble => self.do_add_double(instr), |
| 414 | Opcode::AddInteger => self.do_add_integer(instr), |
| 415 | Opcode::Alloc => self.do_alloc(instr, heap), |
| 416 | Opcode::AllocArray => self.do_alloc_array(instr, heap), |
| 417 | Opcode::BitwiseAnd => self.do_bitwise_and(instr), |
| 418 | Opcode::BitwiseNot => self.do_bitwise_not(instr), |
| 419 | Opcode::BitwiseOr => self.do_bitwise_or(instr), |
| 420 | Opcode::BitwiseXor => self.do_bitwise_xor(instr), |
| 421 | Opcode::Call => self.do_call(instr), |
| 422 | Opcode::Concat => self.do_concat(instr, &image.constants, heap), |
| 423 | Opcode::DivideDouble => self.do_divide_double(instr), |
| 424 | Opcode::DivideInteger => self.do_divide_integer(instr), |
| 425 | Opcode::DoubleToInteger => self.do_double_to_integer(instr), |
| 426 | Opcode::EqualBoolean => self.do_equal_boolean(instr), |
| 427 | Opcode::EqualDouble => self.do_equal_double(instr), |
| 428 | Opcode::EqualInteger => self.do_equal_integer(instr), |
| 429 | Opcode::EqualText => self.do_equal_text(instr, &image.constants, heap), |
| 430 | Opcode::End => self.do_end(instr), |
| 431 | Opcode::Eof => self.do_eof(instr), |
| 432 | Opcode::Gosub => self.do_gosub(instr), |
| 433 | Opcode::GreaterDouble => self.do_greater_double(instr), |
| 434 | Opcode::GreaterEqualDouble => self.do_greater_equal_double(instr), |
| 435 | Opcode::GreaterEqualInteger => self.do_greater_equal_integer(instr), |
| 436 | Opcode::GreaterEqualText => { |
| 437 | self.do_greater_equal_text(instr, &image.constants, heap) |
| 438 | } |
| 439 | Opcode::GreaterInteger => self.do_greater_integer(instr), |
| 440 | Opcode::GreaterText => self.do_greater_text(instr, &image.constants, heap), |
| 441 | Opcode::IntegerToDouble => self.do_integer_to_double(instr), |
| 442 | Opcode::Jump => self.do_jump(instr), |
| 443 | Opcode::JumpIfFalse => self.do_jump_if_false(instr), |
| 444 | Opcode::LessDouble => self.do_less_double(instr), |
| 445 | Opcode::LessEqualDouble => self.do_less_equal_double(instr), |
| 446 | Opcode::LessEqualInteger => self.do_less_equal_integer(instr), |
| 447 | Opcode::LessEqualText => self.do_less_equal_text(instr, &image.constants, heap), |
| 448 | Opcode::LessInteger => self.do_less_integer(instr), |
| 449 | Opcode::LessText => self.do_less_text(instr, &image.constants, heap), |
| 450 | Opcode::LoadArray => self.do_load_array(instr, heap), |
| 451 | Opcode::LoadConstant => self.do_load_constant(instr, &image.constants), |
| 452 | Opcode::LoadInteger => self.do_load_integer(instr), |
| 453 | Opcode::LoadRegisterPointer => self.do_load_register_ptr(instr), |
| 454 | Opcode::ModuloDouble => self.do_modulo_double(instr), |
| 455 | Opcode::ModuloInteger => self.do_modulo_integer(instr), |
| 456 | Opcode::Move => self.do_move(instr), |
| 457 | Opcode::MultiplyDouble => self.do_multiply_double(instr), |
| 458 | Opcode::MultiplyInteger => self.do_multiply_integer(instr), |
| 459 | Opcode::NegateDouble => self.do_negate_double(instr), |
nothing calls this directly
no test coverage detected