Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Generational garbage collector #455

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

acondolu
Copy link
Contributor

@acondolu acondolu commented Feb 14, 2020

Context

The current asterius garbage collector is a copying collector, traversing all live heap objects whenever invoked. Performing a complete ("major") garbage collection each time is quite expensive, and usual runtime systems employ generational collectors, where objects in the heap are segregated according to their age; most times, only the youngest objects are garbage collected ("minor" collection).

Changes

This PR implements a simple generational GC, with two generations: gen 0 is the youngest and gen 1 the oldest. It requires inter-generational pointers (from gen 1 to gen 0) to be recorded, so to used them as roots during a minor collection. All young closures that survive a minor collection are promoted to gen 1 (i.e. generations are not divided in additional steps).

Special care has to be taken so to handle correctly "pinned" blocks: in the asterius runtime, the closures allocated in pinned blocks will not be moved by the garbage collector - this means that a different kind of promotion applies to pinned closures.

Related PRs

Work in progress

There is mainly one feature missing: deciding when the collector should select a minor vs major collection. Probably need to fine tune the parameters and verify reduced running times of tests.

@acondolu acondolu force-pushed the wip-generational-gc branch from 380cac3 to 12e7ba7 Compare February 25, 2020 15:33
@acondolu acondolu mentioned this pull request Feb 28, 2020
@acondolu acondolu force-pushed the wip-generational-gc branch from 12e7ba7 to a3b4519 Compare March 2, 2020 14:35
@acondolu acondolu force-pushed the wip-generational-gc branch 4 times, most recently from 7610278 to 9588026 Compare March 6, 2020 16:40
@acondolu acondolu force-pushed the wip-generational-gc branch 3 times, most recently from b79c4be to 1918eb7 Compare March 11, 2020 15:00
@acondolu acondolu requested a review from TerrorJack March 12, 2020 15:13
@acondolu acondolu force-pushed the wip-generational-gc branch from 30250c5 to 1a28760 Compare March 29, 2020 15:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant