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

Method visit_br_if

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

Source from the content-addressed store, hash-verified

328 }
329
330 fn visit_br_if(&mut self, depth: u32) -> Self::Output {
331 let cond_jump_ip = self.instructions.len();
332 self.instructions.push(Instruction::JumpIfZero32(0));
333
334 let branch_side_start = self.instructions.len();
335 self.emit_dropkeep_to_label(depth);
336
337 if self.instructions.len() == branch_side_start
338 && let Some(ctx_idx) = self.get_ctx_idx(depth)
339 {
340 self.instructions[cond_jump_ip] = Instruction::JumpIfNonZero32(0);
341 self.ctx_stack[ctx_idx].branch_jumps.push(cond_jump_ip);
342 return;
343 }
344
345 self.emit_branch_jump_or_return(depth);
346 self.patch_jump_if_zero(cond_jump_ip, self.instructions.len());
347 }
348
349 fn visit_br_table(&mut self, targets: wasmparser::BrTable<'_>) -> Self::Output {
350 let ts = targets

Callers

nothing calls this directly

Calls 6

get_ctx_idxMethod · 0.80
patch_jump_if_zeroMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected