Update the stack limit checker to multi-entry functions

Similar to the exception handlers (07e1930), this was a matter of
marking all of the entries to a function and building a new main
function that has new globals (while making sure to update the new
function entries properly).