unison-runtime-0.0.0
Safe HaskellNone
LanguageHaskell2010

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

Documentation

data Exit Source #

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.

type ExitIndex = Int Source #

1-based; 0 is OK and negative values are errors.

data Exits Source #

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.

countExit :: Exits -> ExitIndex -> IO Int Source #

Counts an exit; gives the total taken so far.

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.

nameEntry :: Exits -> Ptr a -> String -> IO () Source #

Records the name of the function at a code address.

entryCounts :: Exits -> IO [(String, Int)] Source #

The entries counted since the last call, by function name.