Initial implementation of maximum stack size calculation