From IFWiki
Jump to: navigation, search

Call stack fields

The call stack format described here has fewer fields than Quetzal's:

  • No variable number to store result. This isn't required: for frames whose result is not being discarded, the interpreter can look at the byte before the return PC to get the @call opcode's store target.
  • No count of local variables. This is required for some interpreters, but presumably Aimfiz and Fweep always allocate 15 local variables for each routine.
  • No count of arguments passed into the routine. I believe this is required for @check_arg_count to work.

--Vaporware 15:52, 8 July 2013 (UTC)

Actually, Aimfiz and Fweep just allocate local variables on the data stack (so there might be less than fifteen); each frame stores a pointer to the start of its data stack (so that it can be discarded when the call returns). I did omit the variable number to store the result for the reason you have specified (the documentation even explicitly says this). However, I did forget the argument count, though (an idea for a way to fix it might be: snnncccc cccccccc aaaaaaaa aaaaaaaa aaaaaaaa, where n is the number of arguments; if I implement this then I will also update the documentation). --Zzo38 18:00, 8 July 2013 (UTC)