oceani: improve construction of per-function stack frame
The stack-frame management was confused - not properly transitioned from
a single function to multiple functions.
Now we pass in the function to be processed, and it has a known list of
variables that were in-scope in that function.
We track when each variable went into or out-of scope, sort them, and
re-use frame space for variables which have already gone out-of-scope.