stgi-1.1: Educational implementation of the STG (Spineless Tagless G-machine)

Safe HaskellNone
LanguageHaskell2010

Stg.Machine.GarbageCollection.Common

Description

Definitions used by various garbage collection algorithms.

Synopsis

Documentation

splitHeapWith :: GarbageCollectionAlgorithm -> StgState -> (Set MemAddr, Map MemAddr MemAddr, StgState) Source #

Split the heap contained in a machine state in three parts: the dead objects that can safely be discarded, a maping from old to new addresses if definitions were moved, and the final state with a cleaned up heap.

data GarbageCollectionAlgorithm Source #

A garbage collection algorithm is a specific way to get rid of unused heap objects.

class Addresses a where Source #

Collect all mentioned addresses in a machine element.

Note that none of the types in Stg.Language contain addresses, since an address is not something present in the STG language, only in the execution contest the language is put in in the Stg.Machine modules.

Minimal complete definition

addrs'

Methods

addrs :: a -> Seq MemAddr Source #

All contained addresses in the order they appear, but without duplicates.

class UpdateAddrs a where Source #

Update all contained addresses in a certain value. Useful for moving garbage collectors.

Minimal complete definition

updateAddrs

Methods

updateAddrs :: (MemAddr -> MemAddr) -> a -> a Source #