| 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, |