| 155 | } |
| 156 | |
| 157 | fn evaluate( |
| 158 | &mut self, |
| 159 | function_name: &str, |
| 160 | arguments: &[DiffValue], |
| 161 | _results: &[DiffValueType], |
| 162 | ) -> Result<Option<Vec<DiffValue>>> { |
| 163 | let arguments: Vec<_> = arguments.iter().map(Val::from).collect(); |
| 164 | |
| 165 | let function = self |
| 166 | .instance |
| 167 | .get_func(&mut self.store, function_name) |
| 168 | .expect("unable to access exported function"); |
| 169 | let ty = function.ty(&self.store); |
| 170 | let mut results = vec![Val::I32(0); ty.results().len()]; |
| 171 | function.call(&mut self.store, &arguments, &mut results)?; |
| 172 | |
| 173 | let results = results.into_iter().map(Val::into).collect(); |
| 174 | Ok(Some(results)) |
| 175 | } |
| 176 | |
| 177 | fn get_global(&mut self, name: &str, _ty: DiffValueType) -> Option<DiffValue> { |
| 178 | Some( |