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

Method emit_br_table_pad

crates/parser/src/visit.rs:696–712  ·  view source on GitHub ↗
(&mut self, depth: u32)

Source from the content-addressed store, hash-verified

694 }
695
696 fn emit_br_table_pad(&mut self, depth: u32) -> (usize, usize, bool) {
697 let pad_start = self.instructions.len();
698 let frame = if self.is_unreachable() { None } else { self.validator.get_control_frame(depth as usize) };
699 let Some(frame) = frame else {
700 let ip = self.instructions.len();
701 self.instructions.push(Instruction::Return);
702 return (pad_start, ip, true);
703 };
704
705 let base = self.stack_base_at_frame(depth as usize);
706 let (c32, c64, c128) = self.label_keep_counts_for_frame(frame);
707 self.emit_dropkeep(base, c32, c64, c128);
708
709 let jump_ip = self.instructions.len();
710 self.instructions.push(Instruction::Jump(0));
711 (pad_start, jump_ip, false)
712 }
713
714 fn patch_branch_jump_or_return(&mut self, depth: u32, jump_ip: usize) {
715 let Some(frame) = self.validator.get_control_frame(depth as usize) else {

Callers 1

visit_br_tableMethod · 0.80

Calls 6

is_unreachableMethod · 0.80
stack_base_at_frameMethod · 0.80
emit_dropkeepMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected