Hacker News new | ask | show | jobs
by _f5ah 770 days ago
A couple months ago I finished translating a simple generational garbage collector from MIPS[1] to x86-64 assembly[2], so that programms emitted by my toy compiler[3] run on the actual hardware instead of a MIPS emulator.

And sure enough, I had introduced a few bugs along the way. Here is a part of just one commit message:

> NoLeak-InsertionSort.cool exposed a problem where we make a copy of a prototype object to pass it as `this` to the constructor. But while evaluating all the other constructor parameters the copy gets promoted to Old Area. As a result any assignments the constructor makes end up recorded in the assignment stack. So that the referenced objects survive the next minor collection whereas they shouldn't have otherwise.

[1]: https://theory.stanford.edu/~aiken/software/cooldist/lib/tra...

[2]: https://github.com/mykolav/coollang-2020-fs/blob/master/src/...

[3]: https://github.com/mykolav/coollang-2020-fs