This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
This PR is a prerequisite for implementing generational garbage collection (PR #455). In fact, generational GC requires to keep track of all the closures in the older generation that contain a pointer to a closure in the younger generation. This means that whenever a closure in the older generation is mutated, we need to record it in a set which is usually called
remembered set
ormut_list
.What
The types of the closures that can mutated at runtime are: Thread State Objects (
TSO
),STACK
, synchronising variables (MVAR
), mutable variables (MUT_VAR
), arrays with pointers (MUT_ARR_PTRS
,SMALL_MUT_ARR_PTRS
),CAF
s, and of courseTHUNK
s. For each of these closure types, we need to ensure that thePrimOps
functions and and the builtin ones manipulating them record correctly their mutation.We provide stub
recordMutable
andrecordMutableCap
builtin methods, which will enqueue mutated closures in amut_list
in a future PR. Note that in all casesrecordMutable
is called only if the mutated closure is clean, and after setting it as dirty.How
The main changes are in the
Cmm.h
file (restored therecordMutable
Cmm macro) and in theBuiltins.hs
file, where various calls to a stubrecordMutable
builtin functions are added.