ddc-core-eval-0.4.1.1: Disciplined Disciple Compiler semantic evaluator for the core language.

Safe HaskellNone

DDC.Core.Eval.Store

Contents

Description

Definition of the store.

Synopsis

Documentation

data Store Source

Constructors

Store 

Fields

storeNextLoc :: Int

Next store location to allocate.

storeNextRgn :: Int

Next region handle to allocate.

storeRegions :: Set Rgn

Region handles already allocated.

storeGlobal :: Set Rgn

Regions that are marked as global, and are not deallocated with a stack discipline.

storeBinds :: Map Loc (Rgn, Type Name, SBind)

Map of locations to store bindings, their types, and the handle for the regions they're in.

Instances

data Loc Source

A store location, tagged with the type of the value contained at that location.

These are pretty printed like l4#.

Constructors

Loc Int (Type Name) 

Instances

data Rgn Source

A region handle.

These are pretty printed like r5#.

Constructors

Rgn Int 

Instances

data SBind Source

Store binding. These are naked objects that can be allocated directly into the heap.

Constructors

SObj

An algebraic data constructor.

SLams

Lambda abstraction, used for recursive bindings. The flag indicates whether each binder is level-1 (True) or level-0 (False).

SThunk

A thunk, used for lazy evaluation.

Fields

sbindThunkExp :: Exp () Name
 

Instances

Operators

initial :: StoreSource

Initial store containing the preallocated regions and bindings.

locUnit :: LocSource

Location of the static unit object.

isUnitOrLocX :: Show a => Exp a Name -> BoolSource

Check whether an expression is the unit constructor, or its static heap location.

newLoc :: Type Name -> Store -> (Store, Loc)Source

Create a new location in the store.

newLocs :: [Type Name] -> Store -> (Store, [Loc])Source

Create several new locations in the store.

newRgn :: Store -> (Store, Rgn)Source

Create a new region in the store.

newRgns :: Int -> Store -> (Store, [Rgn])Source

Create several new regions in the store

delRgn :: Rgn -> Store -> StoreSource

Delete a region, removing all its bindings.

hasRgn :: Store -> Rgn -> BoolSource

Check whether a store contains the given region.

setGlobal :: Rgn -> Store -> StoreSource

Set a region as being global.

addBind :: Loc -> Rgn -> Type Name -> SBind -> Store -> StoreSource

Add a store binding to the store, at the given location.

allocBind :: Rgn -> Type Name -> SBind -> Store -> (Store, Loc)Source

Allocate a new binding into the given region, returning the new location.

allocBinds :: [[Loc] -> (Rgn, Type Name, SBind)] -> [Type Name] -> Store -> (Store, [Loc])Source

Alloc some recursive bindings into the given region, returning the new locations.

lookupBind :: Loc -> Store -> Maybe SBindSource

Lookup a the binding for a location.

lookupTypeOfLoc :: Loc -> Store -> Maybe (Type Name)Source

Lookup the type of a store location.

lookupRegionTypeBind :: Loc -> Store -> Maybe (Rgn, Type Name, SBind)Source

Lookup the region handle, type and binding for a location.