Intended for use in builtin shortcutting operations. Offset applies after normal pc increment. For example, JumpTo(0) is a no-op, JumpTo(1) skips the expected next step.
| 351 | // Offset applies after normal pc increment. For example, JumpTo(0) is a |
| 352 | // no-op, JumpTo(1) skips the expected next step. |
| 353 | absl::Status JumpTo(int offset) { |
| 354 | ABSL_DCHECK_LE(offset, static_cast<int>(execution_path_.size())); |
| 355 | ABSL_DCHECK_GE(offset, -static_cast<int>(pc_)); |
| 356 | |
| 357 | int new_pc = static_cast<int>(pc_) + offset; |
| 358 | if (new_pc < 0 || new_pc > static_cast<int>(execution_path_.size())) { |
| 359 | return absl::Status(absl::StatusCode::kInternal, |
| 360 | absl::StrCat("Jump address out of range: position: ", |
| 361 | pc_, ", offset: ", offset, |
| 362 | ", range: ", execution_path_.size())); |
| 363 | } |
| 364 | pc_ = static_cast<size_t>(new_pc); |
| 365 | return absl::OkStatus(); |
| 366 | } |
| 367 | |
| 368 | // Move pc to a subexpression. |
| 369 | // |