Used for loading the values of an array-call host function's value array. This can be used to load arguments out of the array if the trampoline we are building exposes the array calling convention, or it can be used to load results out of the array if the trampoline we are building calls a function that uses the array calling convention.
(
&self,
types: &[WasmValType],
builder: &mut FunctionBuilder,
values_vec_ptr: Value,
values_vec_capacity: Value,
)
| 1218 | /// load results out of the array if the trampoline we are building calls a |
| 1219 | /// function that uses the array calling convention. |
| 1220 | fn load_values_from_array( |
| 1221 | &self, |
| 1222 | types: &[WasmValType], |
| 1223 | builder: &mut FunctionBuilder, |
| 1224 | values_vec_ptr: Value, |
| 1225 | values_vec_capacity: Value, |
| 1226 | ) -> Vec<ir::Value> { |
| 1227 | let isa = &*self.isa; |
| 1228 | let value_size = mem::size_of::<u128>(); |
| 1229 | |
| 1230 | self.debug_assert_enough_capacity_for_length(builder, types.len(), values_vec_capacity); |
| 1231 | |
| 1232 | // Note that this is little-endian like `store_values_to_array` above, |
| 1233 | // see notes there for more information. |
| 1234 | let flags = MemFlagsData::new() |
| 1235 | .with_notrap() |
| 1236 | .with_endianness(ir::Endianness::Little); |
| 1237 | |
| 1238 | let mut results = Vec::new(); |
| 1239 | for (i, ty) in types.iter().enumerate() { |
| 1240 | results.push(crate::unbarriered_load_type_at_offset( |
| 1241 | isa, |
| 1242 | &mut builder.cursor(), |
| 1243 | *ty, |
| 1244 | flags, |
| 1245 | values_vec_ptr, |
| 1246 | i32::try_from(i * value_size).unwrap(), |
| 1247 | )); |
| 1248 | } |
| 1249 | results |
| 1250 | } |
| 1251 | |
| 1252 | fn function_compiler(&self) -> FunctionCompiler<'_> { |
| 1253 | let saved_context = self.contexts.lock().unwrap().pop(); |
no test coverage detected