Fix #904: Use trampolining to eliminate CPS recursion in optimizer
Merge pull request #975 from gzm0/opt-so

Fix #904: Use trampolining to eliminate CPS recursion in optimizer