Merge "Optimize stack overflow handling."