|
In the left column (VM command), the first command - call says:
“(calling a function f after n arguments have been pushed onto the stack)”
These are pushes done outside/before the call command.
The third command - return says:
“(from a function)”
Shouldn’t this third command say: “from a function after the return value has been pushed”?
This (return value) push is also done outside/before the return command.
If that push is not done before return starts, the current “top” value is popped:
… If the function has local variables, the latest variable value is popped.
… If the function has 0 variables, the THAT value is popped.
For this third step to work as expected, the return value must be pushed before return starts.
|