| 2078 | } |
| 2079 | |
| 2080 | fn br_table32(&mut self, idx: XReg, amt: u32) -> ControlFlow<Done> { |
| 2081 | let idx = self.state[idx].get_u32().min(amt - 1) as isize; |
| 2082 | // SAFETY: part of the contract of the interpreter is only dealing with |
| 2083 | // valid bytecode, so this offset should be safe. |
| 2084 | self.pc = unsafe { self.pc.offset(idx * 4) }; |
| 2085 | |
| 2086 | // Decode the `PcRelOffset` without tampering with `self.pc` as the |
| 2087 | // jump is relative to `self.pc`. |
| 2088 | let mut tmp = self.pc; |
| 2089 | let Ok(rel) = PcRelOffset::decode(&mut tmp); |
| 2090 | let offset = isize::try_from(i32::from(rel)).unwrap(); |
| 2091 | self.pc = unsafe { self.pc.offset(offset) }; |
| 2092 | ControlFlow::Continue(()) |
| 2093 | } |
| 2094 | |
| 2095 | fn stack_alloc32(&mut self, amt: u32) -> ControlFlow<Done> { |
| 2096 | let amt = usize::try_from(amt).unwrap(); |