| 251 | } |
| 252 | |
| 253 | fn push_frame(&mut self, function: &'a Function) { |
| 254 | if let Some(frame) = self.frame_stack.iter().last() { |
| 255 | self.frame_offset += frame.function().fixed_stack_size() as usize; |
| 256 | } |
| 257 | |
| 258 | // Grow the stack by the space necessary for this frame |
| 259 | self.stack |
| 260 | .extend(iter::repeat(0).take(function.fixed_stack_size() as usize)); |
| 261 | |
| 262 | self.frame_stack.push(Frame::new(function)); |
| 263 | } |
| 264 | fn pop_frame(&mut self) { |
| 265 | if let Some(frame) = self.frame_stack.pop() { |
| 266 | // Shorten the stack after exiting the frame |