Use ArrayStack for tracking accumulation in tailrec folding

Improves performance in AST rewriting by several orders of magnitude