definition module Sjit.Compile from Data.Map import :: Map from Data.Maybe import :: Maybe from Sjit.Syntax import :: Function :: Instr = PushRef !Int | PushI !Int | Put !Int | Pop !Int | Call !Int | Ret | Halt | IAddRet | IMulRet | ISubRet | IDivRet :: Program :== {!Instr} :: CompileState = { vars :: !Map String Int , funs :: !Map String Int , sp :: !Int , pc :: !Int , blocks :: ![!Program!] , jitst :: !JITState } :: JITState = { n_instr :: !Int , code_start :: !Int , code_len :: !Int , code_ptr :: !Int , mapping :: !Int } appendProgram :: !Bool !Program !JITState -> JITState bootstrap :: (!Program, !CompileState) compile :: !Function !CompileState -> CompileState compile_all :: !(Maybe CompileState) ![Function] -> CompileState