compilerSince PR 1306. Heavily changed in PR1831. Again changed in PR1869.
module compiler
type libID = string
// <name>-<version>@<hash>
case pubKeep // random topic
case pubAutoDel // random topic with ".autodel" suffix (deleted by VM)
case pubShared // predictable topic, no ".autodel"
type pubMode = pubKeep | pubAutoDel | pubShared
type pubConfig =
{ libPubMode : pubMode,
exePubMode : pubMode,
privatePrefix : string,
sharedPrefix : string
}
type storedBinary =
{ db: db.database,
_rmx_id: db.recordID,
dataRef: db.recordID
}
type library =
{ name : string,
version : number,
hash : string,
app : string,
id : libID,
requires : array(libID),
stdlibId : libID,
variant : string,
header : string,
modules : array(string),
ruleHash : string,
part: option(string) // added in PR1869
}
type libraryAtTopic =
{ lib : library,
topic : string,
haveDbg : bool // at topic + ".dbg"
}
type libraryInDB =
{ lib : library,
stored : storedBinary,
storedDbg : option(storedBinary)
}
case mainExe
case standaloneExe(string) // arg: the linked library
type exeName = mainExe | standaloneExe
// new in PR1869
def exeKey : exeName -> string // new in PR1869
type executable =
{ app : string,
requires : array(libID),
stdlibId : libID,
variant : string,
header : string,
override : string,
modules : array(string),
ruleHash: string, // new in PR1869
part: option(string), // new in PR1869
name: exeName // new in PR1869
}
type executableAtTopic =
{ exe : executable,
topic : string,
haveDbg : bool
}
type executableInDB =
{ exe : executable,
stored : storedBinary,
storedDbg : option(storedBinary)
}
type hdrReq =
{ reqname:string, reqversion:number, reqhash:string }
type ondemandLib =
{ odid: hdrReq,
odorigins: array(string),
odtriggers: array(string)
}
// differs from loader.odLib: odid is a record. This version is used
// in the header as stored in the database, and also in the header
// inside the code blob
type header =
{ format: string,
isexe: bool,
abi: number,
requires: array(hdrReq),
version: number,
hash: string,
numsections: number,
numglobals: number,
ondemand: array(ondemandLib),
provides: data, // compiler-internal field
//aliases: data, // compiler-internal field
expglb: data, // compiler-internal field
allmods: data // compiler-internal field
}
type override =
{ ondemand: array(ondemandLib)
}
case originLoaded
case originDatabase(string)
type origin = originLoaded | originDatabase
// Library ID
def formatLibID : string -> number -> string -> libID
def formatLibID_Req : hdrReq -> libID
def parseLibID : libID -> result(string, [ string, number, string ])
def parseLibID_Req : libID -> result(string, hdrReq)
// Stored Binaries
def mkStoredBinary : db.database -> db.record -> storedBinary
def storedIDs : storedBinary -> array(db.recordID)
def libStoredIDs : libraryInDB -> array(db.recordID)
// Origins
def parseOrigin : string -> option(origin)
def formatOrigin : origin -> string
// Blobs
def blobLoad : storedBinary -> binary
def blobSave : appstate -> db.database -> binary -> db.recordID
module end
This module mainly contains types that are needed for representing libraries and executables.