(
&self,
size: AddressSize,
slot: StackSlot,
offset: u64,
)
| 291 | } |
| 292 | |
| 293 | fn stack_address( |
| 294 | &self, |
| 295 | size: AddressSize, |
| 296 | slot: StackSlot, |
| 297 | offset: u64, |
| 298 | ) -> Result<Address, MemoryError> { |
| 299 | let stack_slots = &self.get_current_function().sized_stack_slots; |
| 300 | let stack_slot = &stack_slots[slot]; |
| 301 | |
| 302 | // offset must be `0 <= Offset < sizeof(SS)` |
| 303 | if offset >= stack_slot.size as u64 { |
| 304 | return Err(MemoryError::InvalidOffset { |
| 305 | offset, |
| 306 | max: stack_slot.size as u64, |
| 307 | }); |
| 308 | } |
| 309 | |
| 310 | // Calculate the offset from the current frame to the requested stack slot |
| 311 | let slot_offset: u64 = stack_slots |
| 312 | .keys() |
| 313 | .filter(|k| k < &slot) |
| 314 | .map(|k| stack_slots[k].size as u64) |
| 315 | .sum(); |
| 316 | |
| 317 | let final_offset = self.frame_offset as u64 + slot_offset + offset; |
| 318 | Address::from_parts(size, AddressRegion::Stack, 0, final_offset) |
| 319 | } |
| 320 | |
| 321 | fn checked_load( |
| 322 | &self, |
no test coverage detected