A general routine analysis of stack effect