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

Method block_weight

cranelift/isle/isle/src/codegen.rs:644–657  ·  view source on GitHub ↗
(block: &Block)

Source from the content-addressed store, hash-verified

642 }
643
644 fn block_weight(block: &Block) -> usize {
645 fn cf_weight(cf: &ControlFlow) -> usize {
646 match cf {
647 ControlFlow::Match { arms, .. } => {
648 arms.iter().map(|a| Codegen::block_weight(&a.body)).sum()
649 }
650 ControlFlow::Equal { body, .. } => Codegen::block_weight(body),
651 ControlFlow::Loop { body, .. } => Codegen::block_weight(body),
652 ControlFlow::Return { .. } => 0,
653 }
654 }
655
656 block.steps.iter().map(|s| 1 + cf_weight(&s.check)).sum()
657 }
658
659 fn emit_block<W: Write>(
660 &self,

Callers

nothing calls this directly

Calls 3

sumMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected