MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / exec_branch_table

Method exec_branch_table

crates/tinywasm/src/interpreter/executor.rs:913–922  ·  view source on GitHub ↗
(&mut self, default_ip: u32, start: u32, len: u32)

Source from the content-addressed store, hash-verified

911 }
912
913 fn exec_branch_table(&mut self, default_ip: u32, start: u32, len: u32) {
914 let idx = <i32>::stack_pop(&mut self.store.value_stack);
915 let target_ip = if idx >= 0 && (idx as u32) < len {
916 self.func.data.branch_table_targets.get((start + idx as u32) as usize).copied().unwrap_or(default_ip)
917 } else {
918 default_ip
919 };
920
921 self.cf.instr_ptr = target_ip;
922 }
923
924 fn exec_drop_keep(&mut self, base32: u16, keep32: u8, base64: u16, keep64: u8, base128: u16, keep128: u8) {
925 let mut base = self.cf.stack_base();

Callers 1

execMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected