ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Copyright | (c) The University of Glasgow 2001
License | BSD-style (see the file LICENSE)
Maintainer | Jeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Sylvain Henry <sylvain.henry@iohk.io> Josh Meredith <josh.meredith@iohk.io>
Stability | experimental
Safe Haskell | Ignore
Language | GHC2021

GHC.StgToJS.Types

Description

Module that holds the Types required for the StgToJS pass

Synopsis

- type G = StateT GenState IO
- data GenState = GenState {
  - gsSettings :: !StgToJSConfig
  - gsModule :: !Module
  - gsId :: !FastMutInt
  - gsIdents :: !IdCache
  - gsUnfloated :: !(UniqFM Id CgStgExpr)
  - gsGroup :: GenGroupState
  - gsGlobal :: [JStgStat]
  }
- data GenGroupState = GenGroupState {
  - ggsToplevelStats :: [JStgStat]
  - ggsClosureInfo :: [ClosureInfo]
  - ggsStatic :: [StaticInfo]
  - ggsStack :: [StackSlot]
  - ggsStackDepth :: Int
  - ggsExtraDeps :: Set OtherSymb
  - ggsGlobalIdCache :: GlobalIdCache
  - ggsForeignRefs :: [ForeignJSRef]
  }
- data StgToJSConfig = StgToJSConfig {
  - csInlinePush :: !Bool
  - csInlineBlackhole :: !Bool
  - csInlineLoadRegs :: !Bool
  - csInlineEnter :: !Bool
  - csInlineAlloc :: !Bool
  - csPrettyRender :: !Bool
  - csTraceRts :: !Bool
  - csAssertRts :: !Bool
  - csBoundsCheck :: !Bool
  - csDebugAlloc :: !Bool
  - csTraceForeign :: !Bool
  - csProf :: !Bool
  - csRuntimeAssert :: !Bool
  - csContext :: !SDocContext
  - csLinkerConfig :: !LinkerConfig
  }
- data ClosureInfo = ClosureInfo {
  - ciVar :: Ident
  - ciRegs :: CIRegs
  - ciName :: FastString
  - ciLayout :: CILayout
  - ciType :: CIType
  - ciStatic :: CIStatic
  }
- data CIRegs
  - = CIRegsUnknown
  - | CIRegs {
    - ciRegsSkip :: Int
    - ciRegsTypes :: [JSRep]
    }
- data CILayout
  - = CILayoutVariable
  - | CILayoutUnknown {
    - layoutSize :: !Int
    }
  - | CILayoutFixed {
    - layoutSize :: !Int
    - layout :: [JSRep]
    }
- data CIType
  - = CIFun {
    - citArity :: !Int
    - citRegs :: !Int
    }
  - | CIThunk
  - | CICon {
    - citConstructor :: !Int
    }
  - | CIPap
  - | CIBlackhole
  - | CIStackFrame
- newtype CIStatic = CIStaticRefs {
  - staticRefs :: [FastString]
  }
- data JSRep
  - = PtrV
  - | VoidV
  - | DoubleV
  - | IntV
  - | LongV
  - | AddrV
  - | ObjV
  - | ArrV
- data IdType
  - = IdPlain
  - | IdEntry
  - | IdConEntry
- data IdKey = IdKey !Word64 !Int !IdType
- data OtherSymb = OtherSymb !Module !FastString
- newtype IdCache = IdCache (Map IdKey Ident)
- newtype GlobalIdCache = GlobalIdCache (UniqFM Ident (IdKey, Id))
- data StackSlot
  - = SlotId !Id !Int
  - | SlotUnknown
- data StaticInfo = StaticInfo {
  - siVar :: !FastString
  - siVal :: !StaticVal
  - siCC :: !(Maybe Ident)
  }
- data StaticAppKind
  - = SAKFun
  - | SAKThunk
  - | SAKData
- data StaticVal
  - = StaticUnboxed !StaticUnboxed
  - | StaticList [StaticArg] (Maybe FastString)
  - | StaticApp StaticAppKind !FastString [StaticArg]
- data StaticUnboxed
  - = StaticUnboxedBool !Bool
  - | StaticUnboxedInt !Integer
  - | StaticUnboxedDouble !SaneDouble
  - | StaticUnboxedString !ByteString
  - | StaticUnboxedStringOffset !ByteString
- data StaticArg
  - = StaticObjArg !FastString
  - | StaticLitArg !StaticLit
  - | StaticConArg !FastString [StaticArg]
- data StaticLit
  - = BoolLit !Bool
  - | IntLit !Integer
  - | NullLit
  - | DoubleLit !SaneDouble
  - | StringLit !FastString
  - | BinLit !ByteString
  - | LabelLit !Bool !FastString
- data ForeignJSRef = ForeignJSRef {
  - foreignRefSrcSpan :: !FastString
  - foreignRefPattern :: !FastString
  - foreignRefSafety :: !Safety
  - foreignRefCConv :: !CCallConv
  - foreignRefArgs :: ![FastString]
  - foreignRefResult :: !FastString
  }
- data LinkableUnit = LinkableUnit {
  - luObjBlock :: ObjBlock
  - luIdExports :: [Id]
  - luOtherExports :: [FastString]
  - luIdDeps :: [Id]
  - luPseudoIdDeps :: [Unique]
  - luOtherDeps :: [OtherSymb]
  - luRequired :: Bool
  - luForeignRefs :: [ForeignJSRef]
  }
- data ObjBlock = ObjBlock {
  - oiSymbols :: [FastString]
  - oiClInfo :: [ClosureInfo]
  - oiStatic :: [StaticInfo]
  - oiStat :: JStat
  - oiRaw :: ByteString
  - oiFExports :: [ExpFun]
  - oiFImports :: [ForeignJSRef]
  }
- data ExpFun = ExpFun {
  - isIO :: !Bool
  - args :: [JSFFIType]
  - result :: !JSFFIType
  }
- data JSFFIType
  - = Int8Type
  - | Int16Type
  - | Int32Type
  - | Int64Type
  - | Word8Type
  - | Word16Type
  - | Word32Type
  - | Word64Type
  - | DoubleType
  - | ByteArrayType
  - | PtrType
  - | RefType
- data TypedExpr = TypedExpr {
  - typex_typ :: !PrimRep
  - typex_expr :: [JStgExpr]
  }
- data PrimRes
  - = PrimInline JStgStat
  - | PRPrimCall JStgStat
- data ExprResult
  - = ExprCont
  - | ExprInline
- newtype ExprValData = ExprValData [JStgExpr]
- data ClosureType
  - = Thunk
  - | Fun
  - | Pap
  - | Con
  - | Blackhole
  - | StackFrame
- ctNum :: ClosureType -> Int
- closureB :: ByteString
- closureNames :: Array ClosureType Ident
- ctJsName :: ClosureType -> String
- data ThreadStatus
  - = Running
  - | Blocked
  - | Finished
  - | Died
- threadStatusNum :: ThreadStatus -> Int
- threadStatusJsName :: ThreadStatus -> String

# Documentation

type G = StateT GenState IO #

A State monad over IO holding the generator state.

data GenState #

The JS code generator state

Constructors

GenState |
Fields gsSettings :: !StgToJSConfig codegen settings, read-only gsModule :: !Module current module gsId :: !FastMutInt unique number for the id generator gsIdents :: !IdCache hash consing for identifiers from a Unique gsUnfloated :: !(UniqFM Id CgStgExpr) unfloated arguments gsGroup :: GenGroupState state for the current binding group gsGlobal :: [JStgStat] global (per module) statements (gets included when anything else from the module is used)

data GenGroupState #

The JS code generator state relevant for the current binding group

Constructors

GenGroupState |
Fields ggsToplevelStats :: [JStgStat] extra toplevel statements for the binding group ggsClosureInfo :: [ClosureInfo] closure metadata (info tables) for the binding group ggsStatic :: [StaticInfo] static (CAF) data in our binding group ggsStack :: [StackSlot] stack info for the current expression ggsStackDepth :: Int current stack depth ggsExtraDeps :: Set OtherSymb extra dependencies for the linkable unit that contains this group ggsGlobalIdCache :: GlobalIdCache ggsForeignRefs :: [ForeignJSRef]

data StgToJSConfig #

The Configuration record for the StgToJS pass

Constructors

StgToJSConfig |
Fields csInlinePush :: !Bool csInlineBlackhole :: !Bool csInlineLoadRegs :: !Bool csInlineEnter :: !Bool csInlineAlloc :: !Bool csPrettyRender :: !Bool csTraceRts :: !Bool csAssertRts :: !Bool csBoundsCheck :: !Bool csDebugAlloc :: !Bool csTraceForeign :: !Bool csProf :: !Bool Profiling enabled csRuntimeAssert :: !Bool Enable runtime assertions settings csContext :: !SDocContext csLinkerConfig :: !LinkerConfig Emscripten linker

data ClosureInfo #

Closure info table

Constructors

ClosureInfo |
Fields ciVar :: Ident entry code identifier: infotable fields are stored as properties of this function ciRegs :: CIRegs size of the payload (in number of JS values) ciName :: FastString friendly name for printing ciLayout :: CILayout heap/stack layout of the object ciType :: CIType type of the object, with extra info where required ciStatic :: CIStatic static references of this object

#### Instances

Instances details

Show ClosureInfo # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> ClosureInfo -> ShowS # show :: ClosureInfo -> String # showList :: [ClosureInfo] -> ShowS #
Binary ClosureInfo # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> ClosureInfo -> IO () # put :: WriteBinHandle -> ClosureInfo -> IO (Bin ClosureInfo) # get :: ReadBinHandle -> IO ClosureInfo #
Eq ClosureInfo # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: ClosureInfo -> ClosureInfo -> Bool # (/=) :: ClosureInfo -> ClosureInfo -> Bool #

data CIRegs #

Closure information, `ClosureInfo`, registers

Constructors

CIRegsUnknown | A value witnessing a state of unknown registers
CIRegs |
Fields ciRegsSkip :: Int unused registers before actual args start ciRegsTypes :: [JSRep] args

#### Instances

Instances details

Show CIRegs # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> CIRegs -> ShowS # show :: CIRegs -> String # showList :: [CIRegs] -> ShowS #
Binary CIRegs # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> CIRegs -> IO () # put :: WriteBinHandle -> CIRegs -> IO (Bin CIRegs) # get :: ReadBinHandle -> IO CIRegs #
Eq CIRegs # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: CIRegs -> CIRegs -> Bool # (/=) :: CIRegs -> CIRegs -> Bool #
Ord CIRegs # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: CIRegs -> CIRegs -> Ordering # (<) :: CIRegs -> CIRegs -> Bool # (<=) :: CIRegs -> CIRegs -> Bool # (>) :: CIRegs -> CIRegs -> Bool # (>=) :: CIRegs -> CIRegs -> Bool # max :: CIRegs -> CIRegs -> CIRegs # min :: CIRegs -> CIRegs -> CIRegs #

data CILayout #

Closure Information, `ClosureInfo`, layout

Constructors

CILayoutVariable | layout stored in object itself, first position from the start
CILayoutUnknown | fixed size, but content unknown (for example stack apply frame)
Fields layoutSize :: !Int closure size in array positions, including entry
CILayoutFixed | whole layout known
Fields layoutSize :: !Int closure size in array positions, including entry layout :: [JSRep] The list of JSReps to layout

#### Instances

Instances details

Show CILayout # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> CILayout -> ShowS # show :: CILayout -> String # showList :: [CILayout] -> ShowS #
Binary CILayout # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> CILayout -> IO () # put :: WriteBinHandle -> CILayout -> IO (Bin CILayout) # get :: ReadBinHandle -> IO CILayout #
Eq CILayout # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: CILayout -> CILayout -> Bool # (/=) :: CILayout -> CILayout -> Bool #
Ord CILayout # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: CILayout -> CILayout -> Ordering # (<) :: CILayout -> CILayout -> Bool # (<=) :: CILayout -> CILayout -> Bool # (>) :: CILayout -> CILayout -> Bool # (>=) :: CILayout -> CILayout -> Bool # max :: CILayout -> CILayout -> CILayout # min :: CILayout -> CILayout -> CILayout #

data CIType #

The type of `ClosureInfo`

Constructors

CIFun |
Fields citArity :: !Int function arity citRegs :: !Int number of registers for the args
CIThunk | The closure is a THUNK
CICon | The closure is a Constructor
Fields citConstructor :: !Int
CIPap | The closure is a Partial Application
CIBlackhole | The closure is a black hole
CIStackFrame | The closure is a stack frame

#### Instances

Instances details

Show CIType # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> CIType -> ShowS # show :: CIType -> String # showList :: [CIType] -> ShowS #
Binary CIType # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> CIType -> IO () # put :: WriteBinHandle -> CIType -> IO (Bin CIType) # get :: ReadBinHandle -> IO CIType #
Eq CIType # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: CIType -> CIType -> Bool # (/=) :: CIType -> CIType -> Bool #
Ord CIType # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: CIType -> CIType -> Ordering # (<) :: CIType -> CIType -> Bool # (<=) :: CIType -> CIType -> Bool # (>) :: CIType -> CIType -> Bool # (>=) :: CIType -> CIType -> Bool # max :: CIType -> CIType -> CIType # min :: CIType -> CIType -> CIType #

newtype CIStatic #

Static references that must be kept alive

Constructors

CIStaticRefs |
Fields staticRefs :: [FastString]

#### Instances

Instances details

Monoid CIStatic # |
Instance details Defined in GHC.StgToJS.Types Methods mempty :: CIStatic # mappend :: CIStatic -> CIStatic -> CIStatic # mconcat :: [CIStatic] -> CIStatic #
Semigroup CIStatic # |
Instance details Defined in GHC.StgToJS.Types Methods (<>) :: CIStatic -> CIStatic -> CIStatic # sconcat :: NonEmpty CIStatic -> CIStatic # stimes :: Integral b => b -> CIStatic -> CIStatic #
Show CIStatic # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> CIStatic -> ShowS # show :: CIStatic -> String # showList :: [CIStatic] -> ShowS #
ToJExpr CIStatic # | static refs: array = references, null = nothing to report note: only works after all top-level objects have been created
Instance details Defined in GHC.StgToJS.Types Methods toJExpr :: CIStatic -> JStgExpr # toJExprFromList :: [CIStatic] -> JStgExpr #
Binary CIStatic # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> CIStatic -> IO () # put :: WriteBinHandle -> CIStatic -> IO (Bin CIStatic) # get :: ReadBinHandle -> IO CIStatic #
Eq CIStatic # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: CIStatic -> CIStatic -> Bool # (/=) :: CIStatic -> CIStatic -> Bool #

data JSRep #

JS primitive representations

Constructors

PtrV | pointer = reference to heap object (closure object), lifted or not. Can also be some RTS object (e.g. TVar#, MVar#, MutVar#, Weak#)
VoidV | no fields
DoubleV | A Double: one field
IntV | An Int (32bit because JS): one field
LongV | A Long: two fields one for the upper 32bits, one for the lower (NB: JS is little endian)
AddrV | a pointer not to the heap: two fields, array + index
ObjV | some JS object, user supplied, be careful around these, can be anything
ArrV | boxed array

#### Instances

Instances details

Bounded JSRep # |
Instance details Defined in GHC.StgToJS.Types Methods minBound :: JSRep # maxBound :: JSRep #
Enum JSRep # |
Instance details Defined in GHC.StgToJS.Types Methods succ :: JSRep -> JSRep # pred :: JSRep -> JSRep # toEnum :: Int -> JSRep # fromEnum :: JSRep -> Int # enumFrom :: JSRep -> [JSRep] # enumFromThen :: JSRep -> JSRep -> [JSRep] # enumFromTo :: JSRep -> JSRep -> [JSRep] # enumFromThenTo :: JSRep -> JSRep -> JSRep -> [JSRep] #
Show JSRep # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> JSRep -> ShowS # show :: JSRep -> String # showList :: [JSRep] -> ShowS #
ToJExpr JSRep # |
Instance details Defined in GHC.StgToJS.Types Methods toJExpr :: JSRep -> JStgExpr # toJExprFromList :: [JSRep] -> JStgExpr #
Binary JSRep # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> JSRep -> IO () # put :: WriteBinHandle -> JSRep -> IO (Bin JSRep) # get :: ReadBinHandle -> IO JSRep #
Eq JSRep # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: JSRep -> JSRep -> Bool # (/=) :: JSRep -> JSRep -> Bool #
Ord JSRep # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: JSRep -> JSRep -> Ordering # (<) :: JSRep -> JSRep -> Bool # (<=) :: JSRep -> JSRep -> Bool # (>) :: JSRep -> JSRep -> Bool # (>=) :: JSRep -> JSRep -> Bool # max :: JSRep -> JSRep -> JSRep # min :: JSRep -> JSRep -> JSRep #

data IdType #

The type of identifiers. These determine the suffix of generated functions in JS Land. For example, the entry function for the `Just` constructor is a `IdConEntry` which compiles to: `function h$ghczminternalZCGHCziInternalziMaybeziJust_con_e() { return h$rs() };` which just returns whatever the stack point is pointing to. Whereas the entry function to `Just` is an `IdEntry` and does the work. It compiles to: `function h$ghczminternalZCGHCziInternalziMaybeziJust_e() { var h$$baseZCGHCziMaybezieta_8KXnScrCjF5 = h$r2; h$r1 = h$c1(h$ghczminternalZCGHCziInternalziMaybeziJust_con_e, h$$ghczminternalZCGHCziInternalziMaybezieta_8KXnScrCjF5); return h$rs(); };` Which loads some payload from register 2, and applies the Constructor Entry function for the Just to the payload, returns the result in register 1 and returns whatever is on top of the stack

Constructors

IdPlain | A plain identifier for values, no suffix added
IdEntry | An entry function, suffix = "_e" in `makeIdentForId`
IdConEntry | A Constructor entry function, suffix = "_con_e" in `makeIdentForId`

#### Instances

Instances details

Enum IdType # |
Instance details Defined in GHC.StgToJS.Types Methods succ :: IdType -> IdType # pred :: IdType -> IdType # toEnum :: Int -> IdType # fromEnum :: IdType -> Int # enumFrom :: IdType -> [IdType] # enumFromThen :: IdType -> IdType -> [IdType] # enumFromTo :: IdType -> IdType -> [IdType] # enumFromThenTo :: IdType -> IdType -> IdType -> [IdType] #
Eq IdType # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: IdType -> IdType -> Bool # (/=) :: IdType -> IdType -> Bool #
Ord IdType # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: IdType -> IdType -> Ordering # (<) :: IdType -> IdType -> Bool # (<=) :: IdType -> IdType -> Bool # (>) :: IdType -> IdType -> Bool # (>=) :: IdType -> IdType -> Bool # max :: IdType -> IdType -> IdType # min :: IdType -> IdType -> IdType #

data IdKey #

Keys to differentiate Ident's in the ID Cache

Constructors

IdKey !Word64 !Int !IdType |

#### Instances

Instances details

Eq IdKey # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: IdKey -> IdKey -> Bool # (/=) :: IdKey -> IdKey -> Bool #
Ord IdKey # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: IdKey -> IdKey -> Ordering # (<) :: IdKey -> IdKey -> Bool # (<=) :: IdKey -> IdKey -> Bool # (>) :: IdKey -> IdKey -> Bool # (>=) :: IdKey -> IdKey -> Bool # max :: IdKey -> IdKey -> IdKey # min :: IdKey -> IdKey -> IdKey #

data OtherSymb #

Some other symbol

Constructors

OtherSymb !Module !FastString |

#### Instances

Instances details

Eq OtherSymb # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: OtherSymb -> OtherSymb -> Bool # (/=) :: OtherSymb -> OtherSymb -> Bool #
Ord OtherSymb # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: OtherSymb -> OtherSymb -> Ordering # (<) :: OtherSymb -> OtherSymb -> Bool # (<=) :: OtherSymb -> OtherSymb -> Bool # (>) :: OtherSymb -> OtherSymb -> Bool # (>=) :: OtherSymb -> OtherSymb -> Bool # max :: OtherSymb -> OtherSymb -> OtherSymb # min :: OtherSymb -> OtherSymb -> OtherSymb #

newtype IdCache #

The identifier cache indexed on `IdKey` local to a module

Constructors

IdCache (Map IdKey Ident) |

newtype GlobalIdCache #

The global Identifier Cache

Constructors

GlobalIdCache (UniqFM Ident (IdKey, Id)) |

data StackSlot #

A Stack Slot is either known or unknown. We avoid maybe here for more strictness.

Constructors

SlotId !Id !Int |
SlotUnknown |

#### Instances

Instances details

Eq StackSlot # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StackSlot -> StackSlot -> Bool # (/=) :: StackSlot -> StackSlot -> Bool #
Ord StackSlot # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: StackSlot -> StackSlot -> Ordering # (<) :: StackSlot -> StackSlot -> Bool # (<=) :: StackSlot -> StackSlot -> Bool # (>) :: StackSlot -> StackSlot -> Bool # (>=) :: StackSlot -> StackSlot -> Bool # max :: StackSlot -> StackSlot -> StackSlot # min :: StackSlot -> StackSlot -> StackSlot #

data StaticInfo #

Constructors

StaticInfo |
Fields siVar :: !FastString global object siVal :: !StaticVal static initialization siCC :: !(Maybe Ident) optional CCS name

#### Instances

Instances details

Show StaticInfo # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> StaticInfo -> ShowS # show :: StaticInfo -> String # showList :: [StaticInfo] -> ShowS #
Binary StaticInfo # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> StaticInfo -> IO () # put :: WriteBinHandle -> StaticInfo -> IO (Bin StaticInfo) # get :: ReadBinHandle -> IO StaticInfo #
Eq StaticInfo # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StaticInfo -> StaticInfo -> Bool # (/=) :: StaticInfo -> StaticInfo -> Bool #

data StaticAppKind #

Constructors

SAKFun | heap object for function
SAKThunk | heap object for CAF
SAKData | regular datacon app

#### Instances

Instances details

Show StaticAppKind # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> StaticAppKind -> ShowS # show :: StaticAppKind -> String # showList :: [StaticAppKind] -> ShowS #
Eq StaticAppKind # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StaticAppKind -> StaticAppKind -> Bool # (/=) :: StaticAppKind -> StaticAppKind -> Bool #

data StaticVal #

Constructors

StaticUnboxed !StaticUnboxed | unboxed constructor (Bool, Int, Double etc)
StaticList [StaticArg] (Maybe FastString) | list initializer (with optional tail)
StaticApp StaticAppKind !FastString [StaticArg] | static application of static args. Can be a CAF, a FUN, or a CON app.

#### Instances

Instances details

Show StaticVal # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> StaticVal -> ShowS # show :: StaticVal -> String # showList :: [StaticVal] -> ShowS #
Binary StaticVal # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> StaticVal -> IO () # put :: WriteBinHandle -> StaticVal -> IO (Bin StaticVal) # get :: ReadBinHandle -> IO StaticVal #
Eq StaticVal # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StaticVal -> StaticVal -> Bool # (/=) :: StaticVal -> StaticVal -> Bool #

data StaticUnboxed #

Constructors

StaticUnboxedBool !Bool |
StaticUnboxedInt !Integer |
StaticUnboxedDouble !SaneDouble |
StaticUnboxedString !ByteString |
StaticUnboxedStringOffset !ByteString |

#### Instances

Instances details

Show StaticUnboxed # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> StaticUnboxed -> ShowS # show :: StaticUnboxed -> String # showList :: [StaticUnboxed] -> ShowS #
Binary StaticUnboxed # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> StaticUnboxed -> IO () # put :: WriteBinHandle -> StaticUnboxed -> IO (Bin StaticUnboxed) # get :: ReadBinHandle -> IO StaticUnboxed #
Eq StaticUnboxed # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StaticUnboxed -> StaticUnboxed -> Bool # (/=) :: StaticUnboxed -> StaticUnboxed -> Bool #
Ord StaticUnboxed # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: StaticUnboxed -> StaticUnboxed -> Ordering # (<) :: StaticUnboxed -> StaticUnboxed -> Bool # (<=) :: StaticUnboxed -> StaticUnboxed -> Bool # (>) :: StaticUnboxed -> StaticUnboxed -> Bool # (>=) :: StaticUnboxed -> StaticUnboxed -> Bool # max :: StaticUnboxed -> StaticUnboxed -> StaticUnboxed # min :: StaticUnboxed -> StaticUnboxed -> StaticUnboxed #

data StaticArg #

Static Arguments. Static Arguments are things that are statically allocated, i.e., they exist at program startup. These are static heap objects or literals or things that have been floated to the top level binding by ghc.

Constructors

StaticObjArg !FastString | reference to a heap object
StaticLitArg !StaticLit | literal
StaticConArg !FastString [StaticArg] | unfloated constructor

#### Instances

Instances details

Show StaticArg # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> StaticArg -> ShowS # show :: StaticArg -> String # showList :: [StaticArg] -> ShowS #
Binary StaticArg # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> StaticArg -> IO () # put :: WriteBinHandle -> StaticArg -> IO (Bin StaticArg) # get :: ReadBinHandle -> IO StaticArg #
Outputable StaticArg # |
Instance details Defined in GHC.StgToJS.Types Methods ppr :: StaticArg -> SDoc #
Eq StaticArg # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StaticArg -> StaticArg -> Bool # (/=) :: StaticArg -> StaticArg -> Bool #

data StaticLit #

A Static literal value

Constructors

BoolLit !Bool |
IntLit !Integer |
NullLit |
DoubleLit !SaneDouble |
StringLit !FastString |
BinLit !ByteString |
LabelLit !Bool !FastString | is function pointer, label (also used for string / binary init)

#### Instances

Instances details

Show StaticLit # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> StaticLit -> ShowS # show :: StaticLit -> String # showList :: [StaticLit] -> ShowS #
ToJExpr StaticLit # |
Instance details Defined in GHC.StgToJS.Types Methods toJExpr :: StaticLit -> JStgExpr # toJExprFromList :: [StaticLit] -> JStgExpr #
Binary StaticLit # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> StaticLit -> IO () # put :: WriteBinHandle -> StaticLit -> IO (Bin StaticLit) # get :: ReadBinHandle -> IO StaticLit #
Outputable StaticLit # |
Instance details Defined in GHC.StgToJS.Types Methods ppr :: StaticLit -> SDoc #
Eq StaticLit # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: StaticLit -> StaticLit -> Bool # (/=) :: StaticLit -> StaticLit -> Bool #

data ForeignJSRef #

A foreign reference to some JS code

Constructors

ForeignJSRef |
Fields foreignRefSrcSpan :: !FastString foreignRefPattern :: !FastString foreignRefSafety :: !Safety foreignRefCConv :: !CCallConv foreignRefArgs :: ![FastString] foreignRefResult :: !FastString

#### Instances

Instances details

Show ForeignJSRef # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> ForeignJSRef -> ShowS # show :: ForeignJSRef -> String # showList :: [ForeignJSRef] -> ShowS #
Binary ForeignJSRef # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> ForeignJSRef -> IO () # put :: WriteBinHandle -> ForeignJSRef -> IO (Bin ForeignJSRef) # get :: ReadBinHandle -> IO ForeignJSRef #

data LinkableUnit #

data used to generate one ObjBlock in our object file

Constructors

LinkableUnit |
Fields luObjBlock :: ObjBlock serializable unit info luIdExports :: [Id] exported names from haskell identifiers luOtherExports :: [FastString] other exports luIdDeps :: [Id] identifiers this unit depends on luPseudoIdDeps :: [Unique] pseudo-id identifiers this unit depends on (fixme) luOtherDeps :: [OtherSymb] symbols not from a haskell id that this unit depends on luRequired :: Bool always link this unit luForeignRefs :: [ForeignJSRef]

data ObjBlock #

one toplevel block in the object file

Constructors

ObjBlock |
Fields oiSymbols :: [FastString] toplevel symbols (stored in index) oiClInfo :: [ClosureInfo] closure information of all closures in block oiStatic :: [StaticInfo] static closure data oiStat :: JStat the code oiRaw :: ByteString raw JS code oiFExports :: [ExpFun] oiFImports :: [ForeignJSRef]

data ExpFun #

Constructors

ExpFun |
Fields isIO :: !Bool args :: [JSFFIType] result :: !JSFFIType

#### Instances

Instances details

Show ExpFun # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> ExpFun -> ShowS # show :: ExpFun -> String # showList :: [ExpFun] -> ShowS #
Binary ExpFun # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> ExpFun -> IO () # put :: WriteBinHandle -> ExpFun -> IO (Bin ExpFun) # get :: ReadBinHandle -> IO ExpFun #
Eq ExpFun # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: ExpFun -> ExpFun -> Bool # (/=) :: ExpFun -> ExpFun -> Bool #
Ord ExpFun # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: ExpFun -> ExpFun -> Ordering # (<) :: ExpFun -> ExpFun -> Bool # (<=) :: ExpFun -> ExpFun -> Bool # (>) :: ExpFun -> ExpFun -> Bool # (>=) :: ExpFun -> ExpFun -> Bool # max :: ExpFun -> ExpFun -> ExpFun # min :: ExpFun -> ExpFun -> ExpFun #

data JSFFIType #

Types of FFI values

Constructors

Int8Type |
Int16Type |
Int32Type |
Int64Type |
Word8Type |
Word16Type |
Word32Type |
Word64Type |
DoubleType |
ByteArrayType |
PtrType |
RefType |

#### Instances

Instances details

Enum JSFFIType # |
Instance details Defined in GHC.StgToJS.Types Methods succ :: JSFFIType -> JSFFIType # pred :: JSFFIType -> JSFFIType # toEnum :: Int -> JSFFIType # fromEnum :: JSFFIType -> Int # enumFrom :: JSFFIType -> [JSFFIType] # enumFromThen :: JSFFIType -> JSFFIType -> [JSFFIType] # enumFromTo :: JSFFIType -> JSFFIType -> [JSFFIType] # enumFromThenTo :: JSFFIType -> JSFFIType -> JSFFIType -> [JSFFIType] #
Show JSFFIType # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> JSFFIType -> ShowS # show :: JSFFIType -> String # showList :: [JSFFIType] -> ShowS #
Binary JSFFIType # |
Instance details Defined in GHC.StgToJS.Object Methods put_ :: WriteBinHandle -> JSFFIType -> IO () # put :: WriteBinHandle -> JSFFIType -> IO (Bin JSFFIType) # get :: ReadBinHandle -> IO JSFFIType #
Eq JSFFIType # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: JSFFIType -> JSFFIType -> Bool # (/=) :: JSFFIType -> JSFFIType -> Bool #
Ord JSFFIType # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: JSFFIType -> JSFFIType -> Ordering # (<) :: JSFFIType -> JSFFIType -> Bool # (<=) :: JSFFIType -> JSFFIType -> Bool # (>) :: JSFFIType -> JSFFIType -> Bool # (>=) :: JSFFIType -> JSFFIType -> Bool # max :: JSFFIType -> JSFFIType -> JSFFIType # min :: JSFFIType -> JSFFIType -> JSFFIType #

data TypedExpr #

Typed expression

Constructors

TypedExpr |
Fields typex_typ :: !PrimRep typex_expr :: [JStgExpr]

#### Instances

Instances details

Outputable TypedExpr # |
Instance details Defined in GHC.StgToJS.Types Methods ppr :: TypedExpr -> SDoc #

data PrimRes #

A Primop result is either an inlining of some JS payload, or a primitive call to a JS function defined in Shim files in base.

Constructors

PrimInline JStgStat | primop is inline, result is assigned directly
PRPrimCall JStgStat | primop is async call, primop returns the next function to run. result returned to stack top in registers

data ExprResult #

Constructors

ExprCont |
ExprInline |

#### Instances

Instances details

Eq ExprResult # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: ExprResult -> ExprResult -> Bool # (/=) :: ExprResult -> ExprResult -> Bool #

newtype ExprValData #

Constructors

ExprValData [JStgExpr] |

#### Instances

Instances details

Eq ExprValData # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: ExprValData -> ExprValData -> Bool # (/=) :: ExprValData -> ExprValData -> Bool #

data ClosureType #

A Closure is one of six types

Constructors

Thunk | The closure is a THUNK
Fun | The closure is a Function
Pap | The closure is a Partial Application
Con | The closure is a Constructor
Blackhole | The closure is a Blackhole
StackFrame | The closure is a stack frame

#### Instances

Instances details

Bounded ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods minBound :: ClosureType # maxBound :: ClosureType #
Enum ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods succ :: ClosureType -> ClosureType # pred :: ClosureType -> ClosureType # toEnum :: Int -> ClosureType # fromEnum :: ClosureType -> Int # enumFrom :: ClosureType -> [ClosureType] # enumFromThen :: ClosureType -> ClosureType -> [ClosureType] # enumFromTo :: ClosureType -> ClosureType -> [ClosureType] # enumFromThenTo :: ClosureType -> ClosureType -> ClosureType -> [ClosureType] #
Ix ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods range :: (ClosureType, ClosureType) -> [ClosureType] # index :: (ClosureType, ClosureType) -> ClosureType -> Int # unsafeIndex :: (ClosureType, ClosureType) -> ClosureType -> Int # inRange :: (ClosureType, ClosureType) -> ClosureType -> Bool # rangeSize :: (ClosureType, ClosureType) -> Int # unsafeRangeSize :: (ClosureType, ClosureType) -> Int #
Show ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> ClosureType -> ShowS # show :: ClosureType -> String # showList :: [ClosureType] -> ShowS #
ToJExpr ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods toJExpr :: ClosureType -> JStgExpr # toJExprFromList :: [ClosureType] -> JStgExpr #
Eq ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: ClosureType -> ClosureType -> Bool # (/=) :: ClosureType -> ClosureType -> Bool #
Ord ClosureType # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: ClosureType -> ClosureType -> Ordering # (<) :: ClosureType -> ClosureType -> Bool # (<=) :: ClosureType -> ClosureType -> Bool # (>) :: ClosureType -> ClosureType -> Bool # (>=) :: ClosureType -> ClosureType -> Bool # max :: ClosureType -> ClosureType -> ClosureType # min :: ClosureType -> ClosureType -> ClosureType #

ctNum :: ClosureType -> Int #

Convert `ClosureType` to an Int

closureB :: ByteString #

closureNames :: Array ClosureType Ident #

ctJsName :: ClosureType -> String #

Convert `ClosureType` to a String

data ThreadStatus #

A thread is in one of 4 states

Constructors

Running | The thread is running
Blocked | The thread is blocked
Finished | The thread is done
Died | The thread has died

#### Instances

Instances details

Bounded ThreadStatus # |
Instance details Defined in GHC.StgToJS.Types Methods minBound :: ThreadStatus # maxBound :: ThreadStatus #
Enum ThreadStatus # |
Instance details Defined in GHC.StgToJS.Types Methods succ :: ThreadStatus -> ThreadStatus # pred :: ThreadStatus -> ThreadStatus # toEnum :: Int -> ThreadStatus # fromEnum :: ThreadStatus -> Int # enumFrom :: ThreadStatus -> [ThreadStatus] # enumFromThen :: ThreadStatus -> ThreadStatus -> [ThreadStatus] # enumFromTo :: ThreadStatus -> ThreadStatus -> [ThreadStatus] # enumFromThenTo :: ThreadStatus -> ThreadStatus -> ThreadStatus -> [ThreadStatus] #
Show ThreadStatus # |
Instance details Defined in GHC.StgToJS.Types Methods showsPrec :: Int -> ThreadStatus -> ShowS # show :: ThreadStatus -> String # showList :: [ThreadStatus] -> ShowS #
Eq ThreadStatus # |
Instance details Defined in GHC.StgToJS.Types Methods (==) :: ThreadStatus -> ThreadStatus -> Bool # (/=) :: ThreadStatus -> ThreadStatus -> Bool #
Ord ThreadStatus # |
Instance details Defined in GHC.StgToJS.Types Methods compare :: ThreadStatus -> ThreadStatus -> Ordering # (<) :: ThreadStatus -> ThreadStatus -> Bool # (<=) :: ThreadStatus -> ThreadStatus -> Bool # (>) :: ThreadStatus -> ThreadStatus -> Bool # (>=) :: ThreadStatus -> ThreadStatus -> Bool # max :: ThreadStatus -> ThreadStatus -> ThreadStatus # min :: ThreadStatus -> ThreadStatus -> ThreadStatus #

threadStatusNum :: ThreadStatus -> Int #

Convert the status of a thread in JS land to an Int

threadStatusJsName :: ThreadStatus -> String #

convert the status of a thread in JS land to a string