|
|
|
|
|
|
| Synopsis |
|
|
|
|
| Data Types
|
|
| Top-level bytecode declarations
|
|
| data BCModule |
| A bytecode program
| | Constructors | | BCModule | | | bcmModule :: String | | | bcmDecls :: [BCDecl] | |
|
|
|
|
| data BCDecl |
| A Declaration is a top level bcode entry
| | Constructors | | Fun | | | fName :: String | | | fPos :: Pos | | | fArity :: Int | | | fArgs :: [String] | | | fCode :: Code | | | fConsts :: ConstTable | | | fIsPrim :: Bool | | | fStack :: Int | | | fNumDictArgs :: Int | | | fFlags :: [LambdaFlags] | |
| | Con | | | cName :: String | | | cPos :: Pos | | | cSize :: Int | | | cTag :: Int | |
| | Prim | | | pName :: String | | | pPos :: Pos | |
| | External | | | xName :: String | | | xPos :: Pos | | | xArity :: Int | | | xCName :: String | | | xCallConv :: String | | | xArgsTypes :: [String] | |
|
|
|
|
| Constant tables
|
|
| type ConstTable = Map CRef ConstItem |
| A constant table maps constant references to constant items
|
|
| data ConstItem |
| A constant in the constant table
| | Constructors | | CGlobal String GType | | | CInt Int | | | CInteger Integer | | | CFloat Float | | | CDouble Double | | | CString String | | | CPos Pos | | | CVarDesc String Pos | |
| Instances | |
|
|
| data GType |
| Common applicative form, function info, node for non-CAF, constructor info,
node for zero arity constructor, primitive function info
| | Constructors | | GCAF | | | GFUN | | | GFUN0 | | | GCON | | | GZCON | | | GPRIM | | | GEXT | |
| Instances | |
|
|
| type CRef = Int |
|
| Code representations
|
|
| data Code |
| Code can be several things;
either a simple list of instructions or a code flow graph
| | Constructors | |
|
|
| data GraphNode |
a graph node is either:
GLinear is eval next
is = the linear sequence of instructions
eval = whether this block has an EVAL at the end
next = the label of the next block
GCase int alts default
int = true if this is a case over integers
alts = the alternatives of the case
default = the default branch of the case, if any
GIf true false
true = the true label of the if
false = the false label of the if
GReturn
terminal node in the graph
| | Constructors | |
|
|
| type Graph = Map GLabel GraphNode |
| A graph associates labels with graph nodes
|
|
| type Jumpers = Map GLabel (Set GLabel) |
| Jumpers lists for each label all the graph nodes that might jump to it
|
|
| data GLabel |
| A graph label, just wraps a label, helps with typechecking and we can sort the other way round
| | Constructors | | Instances | |
|
|
| data Write |
| A write is a data section that should be written to the final bytecode file, Label is used as a placeholder
| | Constructors | | WUByte Int | | | WUShort Int | | | WLabel Int Label | | | WByte Int | | | WShort Int | |
|
|
|
| data Ins |
| The instructions
| | Constructors | | Instances | |
|
|
| data PrimOp |
| Constructors | | Instances | |
|
|
| type Tag = Int |
|
| type Label = Int |
|
| Use sets
|
|
| data UseSet |
| The use set for an instruction lists the variables that the instructions gives
as well as those that it needs, from this we can calculate what should be zapped.
| | Constructors | | UseSet | | | useDepth :: Int | | | useGive :: [String] | | | useNeed :: (Set String) | |
|
|
|
|
| emptyUS :: UseSet |
| Create an empty use set
|
|
| type UseIns = (Ins, UseSet) |
| A bytecode instruction paired with its use set
|
|
| Constants
|
|
| xFlNone :: Int |
|
| xFlVoid :: Int |
|
| fNone :: Int |
|
| fInvisible :: Int |
|
| fLambda :: Int |
|
| intFlags :: [LambdaFlags] -> Int |
|
| frameSize :: Int |
|
| calcHeapExtra :: Flags -> Int |
|
| splitQualified :: String -> (String, String) |
| split a qualified name into (module,item)
|
|
| Produced by Haddock version 0.8 |