Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype RegID = RegID Int
- newtype BinAddress = BA {}
- data OffsetStride
- data Locus
- data Offset
- data Value
- version :: Int
- class IsLocus t where
- class IsValue t where
- newtype V t = V t
- (!%) :: IsLocus l => l -> (OffsetStride, Offset) -> Locus
- (!) :: IsLocus l => l -> Offset -> Locus
- t'Register :: Traversal' Locus RegID
- t'AtOffset :: Traversal' Locus (Locus, OffsetStride, Offset)
- t'Variable :: Traversal' Value Locus
- baseRegister :: Locus -> RegID
- data BinaryCode = BC {}
- class BCSerializable t where
- bcSize :: Lens' BinaryCode Int
- bcEstimate :: Lens' BinaryCode Int
- bData :: Lens' BinaryCode Bytes
- binaryCode :: Serializable Bytes s => (Maybe Int, Int) -> s -> BinaryCode
- bytesCode :: (Maybe Int, Int) -> Bytes -> BinaryCode
- bytesCode' :: Bytes -> BinaryCode
- data Section
- data Runtime s = Runtime {
- _rtAddresses :: Map (AnnExpr s) BinAddress
- _rtPartial :: Map Int BinAddress
- _rtBuiltins :: Map (Section, String) BinAddress
- _rtRawSections :: Map Hash BinAddress
- _rtSections :: Map Section (BinaryCode, BinAddress)
- _rtDirty :: Map Int Bool
- rtAddresses :: Lens (Map (AnnExpr s) BinAddress) (Map (AnnExpr s') BinAddress) (Runtime s) (Runtime s')
- rtPartial :: Lens' (Runtime s) (Map Int BinAddress)
- rtBuiltins :: Lens' (Runtime s) (Map (Section, String) BinAddress)
- rtBuiltin :: Section -> String -> Lens' (Runtime s) BinAddress
- rtSections :: Lens' (Runtime s) (Map Section (BinaryCode, BinAddress))
- rtSection :: Section -> Lens' (Runtime s) (BinaryCode, BinAddress)
- rtDirty :: Int -> Lens' (Runtime s) Bool
- defaultRuntime :: Runtime s
- newtype ASMT s m a = ASMT (StateT (Runtime s) (CounterT BinaryCode BinAddress m) a)
- class (MonadCounter BinaryCode BinAddress m, MonadFix m, MonadState (Runtime s) m) => MonadASM m s | m -> s
- i'ASMT :: Iso (ASMT s m a) (ASMT s' m' a') (StateT (Runtime s) (CounterT BinaryCode BinAddress m) a) (StateT (Runtime s') (CounterT BinaryCode BinAddress m') a')
- runASMT :: MonadFix m => Runtime s -> ASMT s m a -> m (a, Runtime s, BinaryCode)
- align :: MonadASM m s => Int -> Word8 -> m ()
- reserve :: MonadASM m s => Int -> Word8 -> m ()
- inSection :: MonadASM m s => Section -> m a -> m a
- rawProgram :: MonadASM m s => [Section] -> m b -> m b
- rawSections :: Map Section BinAddress
- type INSTR0 = forall m s. MonadASM m s => m ()
- type INSTR1 a = forall m s. MonadASM m s => a -> m ()
- type INSTR2 a b = forall m s. MonadASM m s => a -> b -> m ()
- type INSTR3 a b c = forall m s. MonadASM m s => a -> b -> c -> m ()
- type INSTR4 a b c d = forall m s. MonadASM m s => a -> b -> c -> d -> m ()
- type INSTR5 a b c d e = forall m s. MonadASM m s => a -> b -> c -> d -> e -> m ()
- type BUILTIN_INSTR = forall m s. MonadASM m s => Builtin -> Maybe (m (BinAddress, Value))
- type CCALL = forall m s. MonadASM m s => Maybe Locus -> BinAddress -> [m Value] -> m ()
- type ALLOC_BYTES = forall m s. MonadASM m s => Locus -> Value -> m ()
- data VonNeumannMachine = VonNeumannMachine {
- _destReg, _thisReg, _tmpReg :: RegID
- _newFunction :: forall m s. MonadASM m s => Section -> m BinAddress
- _cp, _add, _sub :: INSTR2 Locus Value
- _load :: INSTR2 Locus BinAddress
- _store :: INSTR2 BinAddress Value
- _push :: INSTR1 Value
- _pop :: INSTR1 (Int :+: Locus)
- _pushThunk, _popThunk :: INSTR1 Locus
- _jcmp :: INSTR5 (Maybe Bool) (Bool, Ordering) Value Value BinAddress
- _jmp, _call :: INSTR1 Value
- _ret :: INSTR0
- _curlyBuiltin :: BUILTIN_INSTR
- _assemblyMachine :: Maybe AssemblyMachine
- data AssemblyMachine = AssemblyMachine {}
- data SystemHooks = SystemHooks {}
- getOrDefine :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> String -> m () -> m BinAddress
- getOrDefineBuiltin :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> String -> Value -> m () -> m (BinAddress, Value)
- getOrDefineBuiltin0 :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> String -> m () -> m (BinAddress, Value)
- globalBuiltin :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress -> Value -> m (BinAddress, Value)
- withAdditionalBuiltins :: BUILTIN_INSTR -> VonNeumannMachine -> VonNeumannMachine
- global_argFun :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress
- global_constant :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress
- global_partialApply :: (?sys :: VonNeumannMachine, MonadASM m s) => Int -> m BinAddress
- global_seq :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress
- builtinArgs :: (?sys :: VonNeumannMachine, MonadASM m s) => Int -> m [Locus]
- commonBuiltin :: (?sys :: VonNeumannMachine) => BUILTIN_INSTR
- data SystemDataRepr = SystemDataRepr {
- sdr_encodeWord16 :: Word16 -> Builder
- sdr_encodeWord32 :: Word32 -> Builder
- sdr_encodeWord64 :: Word64 -> Builder
- sdr_encodeWordN :: Word32 -> Builder
- sdr_byteOrder :: Bool
- sdr_wordSize :: Int
- tellWordN :: MonadWriter BinaryCode m => SystemDataRepr -> Word32 -> m ()
- assemblyBuiltin :: (?sysHooks :: SystemHooks, ?sys :: VonNeumannMachine) => SystemDataRepr -> BUILTIN_INSTR
- (<--) :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v) => l -> v -> m ()
- setThunkVal :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v, IsValue v') => l -> v -> v' -> m ()
- (<==) :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsLocus l') => l -> l' -> m ()
- pushV :: (?sys :: VonNeumannMachine, IsValue v) => INSTR1 v
- popV :: (?sys :: VonNeumannMachine, IsLocus l) => INSTR1 l
- popN :: (?sys :: VonNeumannMachine) => INSTR1 Int
- jcmp_hint :: (?sys :: VonNeumannMachine, IsValue v, IsValue v') => INSTR5 (Maybe Bool) (Bool, Ordering) v v' BinAddress
- ifcmp_hint :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => Maybe Bool -> (Bool, Ordering) -> v -> v' -> m () -> m ()
- itecmp_hint :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => Maybe Bool -> (Bool, Ordering) -> v -> v' -> m () -> m () -> m ()
- jcmp :: (?sys :: VonNeumannMachine, IsValue v, IsValue v') => INSTR4 (Bool, Ordering) v v' BinAddress
- ifcmp :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => (Bool, Ordering) -> v -> v' -> m () -> m ()
- itecmp :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => (Bool, Ordering) -> v -> v' -> m () -> m () -> m ()
- jmp :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v) => v -> m ()
- call :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v) => v -> m ()
- ret :: (?sys :: VonNeumannMachine, MonadASM m s) => m ()
- tailCall :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus v, IsValue v) => v -> m ()
- load :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => l -> BinAddress -> m ()
- store :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v) => BinAddress -> v -> m ()
- add :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v) => l -> v -> m ()
- sub :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v) => l -> v -> m ()
- assemblyMachine :: (?sys :: VonNeumannMachine) => AssemblyMachine
- ccall_void :: Maybe Locus
- ccall :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => Maybe l -> BinAddress -> [m Value] -> m ()
- ccall0 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => Maybe l -> BinAddress -> m ()
- ccall1 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v) => Maybe l -> BinAddress -> m v -> m ()
- ccall2 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v, IsValue v') => Maybe l -> BinAddress -> m v -> m v' -> m ()
- ccall3 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v, IsValue v', IsValue v'') => Maybe l -> BinAddress -> m v -> m v' -> m v'' -> m ()
- cret :: (?sys :: VonNeumannMachine) => RegID
- poolReg :: (?sys :: VonNeumannMachine) => RegID
- wordSize :: (?sys :: VonNeumannMachine, Num n) => n
- pageSize :: (?sys :: VonNeumannMachine, Num n) => n
- thunkSize :: (?sys :: VonNeumannMachine, Num n, Semiring n) => n
- pushThunk :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => l -> m ()
- popThunk :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => l -> m ()
- callThunk :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v) => v -> m ()
- newFunction :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> m BinAddress
- callWithStackArgs :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => v -> [m v'] -> m ()
- destReg :: (?sys :: VonNeumannMachine) => RegID
- tmpReg :: (?sys :: VonNeumannMachine) => RegID
- thisReg :: (?sys :: VonNeumannMachine) => RegID
- allocBytes :: (?sysHooks :: SystemHooks, IsLocus l, IsValue v, MonadASM m s) => l -> v -> m ()
- pushing :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => [l] -> m a -> m a
- rotateL :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => [l] -> m ()
- setDest :: (?sys :: VonNeumannMachine, IsValue v, IsValue v', MonadASM m s) => v -> v' -> m ()
- specialize :: forall m. (?sys :: VonNeumannMachine, MonadASM m GlobalID) => String -> AnnExpr GlobalID -> m BinAddress
- newtype Standalone = Standalone {
- standalone :: forall m s. MonadASM m s => m BinAddress -> m ()
- data SysImpl
- = Imperative (Maybe SystemHooks -> VonNeumannMachine)
- | RawSystem (LeafExpr GlobalID -> Bytes)
- data System = System {}
Documentation
newtype BinAddress Source #
data OffsetStride Source #
t'AtOffset :: Traversal' Locus (Locus, OffsetStride, Offset) Source #
baseRegister :: Locus -> RegID Source #
data BinaryCode Source #
Semigroup BinaryCode Source # | |
Monoid BinaryCode Source # | |
SubSemi BinAddress BinaryCode Source # | |
Monad m => MonadCounter BinaryCode BinAddress (ASMT s m) Source # | |
Monad m => MonadWriter BinaryCode (ASMT s m) Source # | |
class BCSerializable t where Source #
bcEncode :: t -> BinaryCode Source #
binaryCode :: Serializable Bytes s => (Maybe Int, Int) -> s -> BinaryCode Source #
bytesCode' :: Bytes -> BinaryCode Source #
Runtime | |
|
rtAddresses :: Lens (Map (AnnExpr s) BinAddress) (Map (AnnExpr s') BinAddress) (Runtime s) (Runtime s') Source #
rtBuiltins :: Lens' (Runtime s) (Map (Section, String) BinAddress) Source #
rtSections :: Lens' (Runtime s) (Map Section (BinaryCode, BinAddress)) Source #
rtSection :: Section -> Lens' (Runtime s) (BinaryCode, BinAddress) Source #
defaultRuntime :: Runtime s Source #
ASMT (StateT (Runtime s) (CounterT BinaryCode BinAddress m) a) |
Monad m => MonadCounter BinaryCode BinAddress (ASMT s m) Source # | |
MonadReader r m => MonadReader r (ASMT s m) Source # | |
Monad m => MonadWriter BinaryCode (ASMT s m) Source # | |
MonadTrans (ASMT s) Source # | |
Monad m => MonadState (Runtime s) (ASMT s m) Source # | |
Functor m => Functor (ASMT s m) Source # | |
Monad m => SemiApplicative (ASMT s m) Source # | |
Monad m => Applicative (ASMT s m) Source # | |
Monad m => Monad (ASMT s m) Source # | |
MonadFix m => MonadFix (ASMT s m) Source # | |
Unit m => Unit (ASMT s m) Source # | |
MonadFix m => MonadASM (ASMT s m) s Source # | |
class (MonadCounter BinaryCode BinAddress m, MonadFix m, MonadState (Runtime s) m) => MonadASM m s | m -> s Source #
i'ASMT :: Iso (ASMT s m a) (ASMT s' m' a') (StateT (Runtime s) (CounterT BinaryCode BinAddress m) a) (StateT (Runtime s') (CounterT BinaryCode BinAddress m') a') Source #
rawProgram :: MonadASM m s => [Section] -> m b -> m b Source #
type BUILTIN_INSTR = forall m s. MonadASM m s => Builtin -> Maybe (m (BinAddress, Value)) Source #
data VonNeumannMachine Source #
VonNeumannMachine | |
|
data AssemblyMachine Source #
data SystemHooks Source #
getOrDefine :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> String -> m () -> m BinAddress Source #
getOrDefineBuiltin :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> String -> Value -> m () -> m (BinAddress, Value) Source #
getOrDefineBuiltin0 :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> String -> m () -> m (BinAddress, Value) Source #
globalBuiltin :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress -> Value -> m (BinAddress, Value) Source #
global_argFun :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress Source #
global_constant :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress Source #
global_partialApply :: (?sys :: VonNeumannMachine, MonadASM m s) => Int -> m BinAddress Source #
global_seq :: (?sys :: VonNeumannMachine, MonadASM m s) => m BinAddress Source #
builtinArgs :: (?sys :: VonNeumannMachine, MonadASM m s) => Int -> m [Locus] Source #
commonBuiltin :: (?sys :: VonNeumannMachine) => BUILTIN_INSTR Source #
data SystemDataRepr Source #
SystemDataRepr | |
|
tellWordN :: MonadWriter BinaryCode m => SystemDataRepr -> Word32 -> m () Source #
assemblyBuiltin :: (?sysHooks :: SystemHooks, ?sys :: VonNeumannMachine) => SystemDataRepr -> BUILTIN_INSTR Source #
(<--) :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v) => l -> v -> m () infix 3 Source #
setThunkVal :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v, IsValue v') => l -> v -> v' -> m () Source #
(<==) :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsLocus l') => l -> l' -> m () infix 3 Source #
jcmp_hint :: (?sys :: VonNeumannMachine, IsValue v, IsValue v') => INSTR5 (Maybe Bool) (Bool, Ordering) v v' BinAddress Source #
ifcmp_hint :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => Maybe Bool -> (Bool, Ordering) -> v -> v' -> m () -> m () Source #
itecmp_hint :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => Maybe Bool -> (Bool, Ordering) -> v -> v' -> m () -> m () -> m () Source #
jcmp :: (?sys :: VonNeumannMachine, IsValue v, IsValue v') => INSTR4 (Bool, Ordering) v v' BinAddress Source #
ifcmp :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => (Bool, Ordering) -> v -> v' -> m () -> m () Source #
itecmp :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => (Bool, Ordering) -> v -> v' -> m () -> m () -> m () Source #
ret :: (?sys :: VonNeumannMachine, MonadASM m s) => m () Source #
load :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => l -> BinAddress -> m () Source #
store :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v) => BinAddress -> v -> m () Source #
assemblyMachine :: (?sys :: VonNeumannMachine) => AssemblyMachine Source #
ccall_void :: Maybe Locus Source #
ccall :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => Maybe l -> BinAddress -> [m Value] -> m () Source #
ccall0 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l) => Maybe l -> BinAddress -> m () Source #
ccall1 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v) => Maybe l -> BinAddress -> m v -> m () Source #
ccall2 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v, IsValue v') => Maybe l -> BinAddress -> m v -> m v' -> m () Source #
ccall3 :: (?sys :: VonNeumannMachine, MonadASM m s, IsLocus l, IsValue v, IsValue v', IsValue v'') => Maybe l -> BinAddress -> m v -> m v' -> m v'' -> m () Source #
cret :: (?sys :: VonNeumannMachine) => RegID Source #
poolReg :: (?sys :: VonNeumannMachine) => RegID Source #
wordSize :: (?sys :: VonNeumannMachine, Num n) => n Source #
pageSize :: (?sys :: VonNeumannMachine, Num n) => n Source #
newFunction :: (?sys :: VonNeumannMachine, MonadASM m s) => Section -> m BinAddress Source #
callWithStackArgs :: (?sys :: VonNeumannMachine, MonadASM m s, IsValue v, IsValue v') => v -> [m v'] -> m () Source #
destReg :: (?sys :: VonNeumannMachine) => RegID Source #
The destination register, a pointer to the thunk where the result of the current computation should be stored.
tmpReg :: (?sys :: VonNeumannMachine) => RegID Source #
thisReg :: (?sys :: VonNeumannMachine) => RegID Source #
The object register, a pointer to the thunk that is currently being evaluated.
allocBytes :: (?sysHooks :: SystemHooks, IsLocus l, IsValue v, MonadASM m s) => l -> v -> m () Source #
setDest :: (?sys :: VonNeumannMachine, IsValue v, IsValue v', MonadASM m s) => v -> v' -> m () Source #
specialize :: forall m. (?sys :: VonNeumannMachine, MonadASM m GlobalID) => String -> AnnExpr GlobalID -> m BinAddress Source #
newtype Standalone Source #
Standalone | |
|