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

Method verify_entity_references

cranelift/codegen/src/verifier/mod.rs:523–760  ·  view source on GitHub ↗
(
        &self,
        inst: Inst,
        errors: &mut VerifierErrors,
    )

Source from the content-addressed store, hash-verified

521 }
522
523 fn verify_entity_references(
524 &self,
525 inst: Inst,
526 errors: &mut VerifierErrors,
527 ) -> VerifierStepResult {
528 use crate::ir::instructions::InstructionData::*;
529
530 for arg in self.func.dfg.inst_values(inst) {
531 self.verify_inst_arg(inst, arg, errors)?;
532
533 // All used values must be attached to something.
534 let original = self.func.dfg.resolve_aliases(arg);
535 if !self.func.dfg.value_is_attached(original) {
536 errors.report((
537 inst,
538 self.context(inst),
539 format!("argument {arg} -> {original} is not attached"),
540 ));
541 }
542 }
543
544 for &res in self.func.dfg.inst_results(inst) {
545 self.verify_inst_result(inst, res, errors)?;
546 }
547
548 // Verify alias region references in memflags.
549 if let Some(flags) = self.func.dfg.insts[inst].memflags() {
550 let flags_data = self.func.dfg.mem_flags[flags];
551 if let Some(region) = flags_data.alias_region() {
552 if !self.func.dfg.alias_regions.is_valid(region) {
553 errors.report((
554 inst,
555 self.context(inst),
556 format!("undefined alias region {region}"),
557 ));
558 }
559 }
560 }
561
562 match self.func.dfg.insts[inst] {
563 MultiAry { ref args, .. } => {
564 self.verify_value_list(inst, args, errors)?;
565 }
566 Jump { destination, .. } => {
567 self.verify_block(inst, destination.block(&self.func.dfg.value_lists), errors)?;
568 }
569 Brif {
570 arg,
571 blocks: [block_then, block_else],
572 ..
573 } => {
574 self.verify_value(inst, arg, errors)?;
575 self.verify_block(inst, block_then.block(&self.func.dfg.value_lists), errors)?;
576 self.verify_block(inst, block_else.block(&self.func.dfg.value_lists), errors)?;
577 }
578 BranchTable { table, .. } => {
579 self.verify_jump_table(inst, table, errors)?;
580 }

Callers 1

instruction_integrityMethod · 0.80

Calls 15

OkFunction · 0.85
inst_valuesMethod · 0.80
verify_inst_argMethod · 0.80
resolve_aliasesMethod · 0.80
value_is_attachedMethod · 0.80
verify_inst_resultMethod · 0.80
verify_value_listMethod · 0.80
verify_blockMethod · 0.80
verify_valueMethod · 0.80
verify_jump_tableMethod · 0.80
verify_func_refMethod · 0.80

Tested by

no test coverage detected