Interpret a call to a [Function] given its [DataValue] arguments.
(
&mut self,
function: &'a Function,
arguments: &[DataValue],
)
| 69 | |
| 70 | /// Interpret a call to a [Function] given its [DataValue] arguments. |
| 71 | fn call( |
| 72 | &mut self, |
| 73 | function: &'a Function, |
| 74 | arguments: &[DataValue], |
| 75 | ) -> Result<ControlFlow<'a>, InterpreterError> { |
| 76 | trace!("Call: {}({:?})", function.name, arguments); |
| 77 | let first_block = function |
| 78 | .layout |
| 79 | .blocks() |
| 80 | .next() |
| 81 | .expect("to have a first block"); |
| 82 | let parameters = function.dfg.block_params(first_block); |
| 83 | self.state.push_frame(function); |
| 84 | self.state |
| 85 | .current_frame_mut() |
| 86 | .set_all(parameters, arguments.to_vec()); |
| 87 | |
| 88 | self.block(first_block) |
| 89 | } |
| 90 | |
| 91 | /// Interpret a [Block] in a [Function]. This drives the interpretation over sequences of |
| 92 | /// instructions, which may continue in other blocks, until the function returns. |
no test coverage detected