| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unison.Runtime.JIT.Exits
Description
The exits table, one per JIT (which is one per process, see JIT.hs). Native code returns an index into it to say what the interpreter should do next. See unison-runtimesrcUnisonRuntimeJIT/design.md.
Synopsis
- data Exit
- isAdHoc :: Exit -> Bool
- type ExitIndex = Int
- data Exits
- newExits :: Bool -> IO Exits
- registerExits :: Exits -> [Exit] -> IO ExitIndex
- replaceExits :: Exits -> ExitIndex -> [Exit] -> IO ()
- lookupExit :: Exits -> ExitIndex -> IO Exit
- countExit :: Exits -> ExitIndex -> IO Int
- exitCounts :: Exits -> IO [(ExitIndex, Exit, Int)]
- resetExitCounts :: Exits -> IO ()
- countEntry :: Exits -> Ptr a -> IO ()
- nameEntry :: Exits -> Ptr a -> String -> IO ()
- entryCounts :: Exits -> IO [(String, Int)]
Documentation
Constructors
| Resume !CombIx !MSection | interpret from this section of this combinator |
| GrowStack !Int !(Ptr NativeCell) | grow the Unison stack to fit a frame of this size, then call the function whose cell this is again (it may not be the one the trampoline entered: tail calls change functions) |
| Reenter !(Ptr NativeCell) | the runtime asked the thread to stop; call the function whose cell this is again when the thread next runs |
| CallOut !CombIx !MInstr !MSection !Int !(Ptr NativeCell) | run this instruction with the interpreter (it pushes the given number of values), then call the function in this cell, which continues with the section after it. If the instruction pushed a different number of values, interpret that section instead. |
| Named String Exit | a description, for statistics |
isAdHoc :: Exit -> Bool Source #
An exit the code didn't cause: the poll (the context-switch flag or the allocation budget) and stack growth land wherever the program happens to be. The others, a call-out or a resume, are taken at a point the code itself reaches on every such path.
The table, the exit counters, and the entry counts (by code address) with the names of the functions entered.
newExits :: Bool -> IO Exits Source #
An empty table. With statistics on, the counters have a slot per exit
index (up to counterSlots); otherwise one, since nothing counts.
registerExits :: Exits -> [Exit] -> IO ExitIndex Source #
Adds a module's exits and returns the index of the first one. The rest follow consecutively, in the order given.
replaceExits :: Exits -> ExitIndex -> [Exit] -> IO () Source #
Overwrites exits registered earlier, starting at the given index: the second code generation pass produces the final ones (with the cells of the auxiliary functions), the first only their number.
exitCounts :: Exits -> IO [(ExitIndex, Exit, Int)] Source #
Every exit that has been taken, with its count.
resetExitCounts :: Exits -> IO () Source #
Starts counting again from zero.
countEntry :: Exits -> Ptr a -> IO () Source #
For UNISON_JIT_STATS: how often the trampoline entered each native
function (by code address), and what each is called. Slow (a map in an
IORef); statistics runs only.