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

Method verify_callee_patchability

cranelift/codegen/src/verifier/mod.rs:948–984  ·  view source on GitHub ↗
(
        &self,
        inst: Inst,
        func_ref: FuncRef,
        opcode: Opcode,
        errors: &mut VerifierErrors,
    )

Source from the content-addressed store, hash-verified

946 }
947
948 fn verify_callee_patchability(
949 &self,
950 inst: Inst,
951 func_ref: FuncRef,
952 opcode: Opcode,
953 errors: &mut VerifierErrors,
954 ) -> VerifierStepResult {
955 let ir::ExtFuncData {
956 patchable,
957 colocated,
958 signature,
959 name: _,
960 } = self.func.dfg.ext_funcs[func_ref];
961 let signature = &self.func.dfg.signatures[signature];
962 if patchable && (opcode == Opcode::ReturnCall || opcode == Opcode::ReturnCallIndirect) {
963 errors.fatal((
964 inst,
965 self.context(inst),
966 "patchable funcref cannot be used in a return_call".to_string(),
967 ))?;
968 }
969 if patchable && !colocated {
970 errors.fatal((
971 inst,
972 self.context(inst),
973 "patchable call to non-colocated function".to_string(),
974 ))?;
975 }
976 if patchable && !signature.returns.is_empty() {
977 errors.fatal((
978 inst,
979 self.context(inst),
980 "patchable call cannot occur to a function with return values".to_string(),
981 ))?;
982 }
983 Ok(())
984 }
985
986 fn verify_value(
987 &self,

Callers 1

Calls 5

OkFunction · 0.85
fatalMethod · 0.80
contextMethod · 0.45
to_stringMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected