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

Function resolve_jump_target

crates/parser/src/optimize.rs:792–807  ·  view source on GitHub ↗
(instrs: &[Instruction], target: u32)

Source from the content-addressed store, hash-verified

790}
791
792fn resolve_jump_target(instrs: &[Instruction], target: u32) -> u32 {
793 let mut idx = next_non_nop(instrs, target as usize);
794 let mut steps = 0usize;
795
796 while idx < instrs.len() && steps < instrs.len() {
797 match instrs[idx] {
798 Instruction::Jump(next) => {
799 idx = next_non_nop(instrs, next as usize);
800 steps += 1;
801 }
802 _ => break,
803 }
804 }
805
806 idx as u32
807}
808
809fn jump_target(instr: Instruction) -> Option<u32> {
810 Some(match instr {

Callers 2

rewriteFunction · 0.85
canonicalize_jump_likeFunction · 0.85

Calls 2

next_non_nopFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected