rust-hosted-langs / book

Writing Interpreters in Rust: a Guide
https://rust-hosted-langs.github.io/book/
Creative Commons Attribution 4.0 International
479 stars 27 forks source link

Bump allocate downward #19

Closed pliniker closed 1 year ago

pliniker commented 4 years ago

It should be fairly straightforward to adjust the allocator to bump-allocate downward from the end of a block rather than upward from the beginning. See https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html for an explanation.

Bump allocation happens inside an available set of Immix lines. The "find-next-line" operation can still look upward for the next set of free lines, but within lines, allocation should bump downward from the end of the lines.

Things to take into account:

I'm not thrilled with the level and quality of unit testing yet, so consider what new tests can improve coverage and corner cases as part of this.

pliniker commented 4 years ago

I'd love this to be a "good first issue" but it does require understanding of Immix and the subject matter in general. It's not such a small issue either due to the need to update the book.

pliniker commented 4 years ago

Additionally, as the book chapter in alignment states, objects should be aligned on double-word boundaries. The object header should be aligned on a word boundary. These constraints are not correctly implemented yet and should be as part of this issue.

pliniker commented 1 year ago

Additionally number 2: the metadata should be inside the memory block, not a separately allocated data structure. I originally did that for easier type management.