MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / br_table32

Method br_table32

pulley/src/interp.rs:2080–2093  ·  view source on GitHub ↗
(&mut self, idx: XReg, amt: u32)

Source from the content-addressed store, hash-verified

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();

Callers

nothing calls this directly

Calls 6

decodeFunction · 0.85
fromFunction · 0.85
minMethod · 0.45
get_u32Method · 0.45
offsetMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected