Open robsimmons opened 10 years ago
Adding the highlighted line seems to fix the problem but I wonder if it has any side effects (num_vars is global for some reason). reset_num_vars sets it back to 0. Currently c0vm-trans.sml computes the number of variables by maintaining a list of variables in scope as it crawls the function. Then every time a new scope is created, it checks if the current number of variables in scope is greater than num_vars. If so it updates num_vars.
If we compile this function
Then the main function has 3 local variables: I think we're giving each function in the program the same number of local variables, the upper bound of all the local variables in all the functions.