optimize stack frames: reuse stack slots when possible