Implement correct Cheney's GC algorithm.

The previous implementation worked but was different from Cheney's algorithm.
The correct Cheney's algorithm should not consume stack.