Small host execution ergos

This commit is contained in:
2026-05-09 18:18:25 -05:00
parent 2773109b87
commit d0886ad886
4 changed files with 510 additions and 26 deletions

View File

@@ -243,35 +243,39 @@ getExportNames_ = y (self acc exports :
getExportNames = (exports :
getExportNames_ t exports)
-- Select an export: prefer explicit name, then "main", then single, then error.
selectExport_ = y (self exports name nameBytes :
matchBool
-- Explicit name given
(matchBool
nothing
(err errMissingSection t)
(_ _ : nothing)
(findExportByName exports nameBytes))
-- No explicit name: try "main"
(matchBool
nothing
(matchBool
(equal? (length exports) 1)
(ok (head exports) t)
mainExportName = "main"
maybeExportToResult = (maybeExport :
triage
(err errMissingSection t)
(export : ok export t)
(_ _ : err errMissingSection t)
maybeExport)
selectSingleExport = (exports :
matchList
(err errMissingSection t)
(export rest :
matchBool
(ok export t)
(err errMissingSection t)
(bytesEq? (exportName (head exports)) nameBytes))
(_ _ : nothing)
(findExportByName exports nameBytes))
-- Single export: auto-select
(matchBool
(equal? (length exports) 1)
(ok (head exports) t)
(err errMissingSection t)
(emptyList? exports))
(emptyList? rest))
exports)
selectDefaultExport = (exports :
triage
(selectSingleExport exports)
(export : ok export t)
(_ _ : err errMissingSection t)
(findExportByName exports mainExportName))
-- Select an export: explicit name if provided, otherwise "main", otherwise
-- the sole export if the bundle has exactly one export.
selectExport = (exports nameBytes :
selectExport_ exports nameBytes nameBytes)
matchBool
(selectDefaultExport exports)
(maybeExportToResult (findExportByName exports nameBytes))
(emptyList? nameBytes))
selectExportOpt = (exports optNameBytes :
selectExport exports optNameBytes)
@@ -304,7 +308,7 @@ manifestRuntimeAbi = (core : pairFirst (pairSecond (pairSecond (pairSecond (pair
manifestCapabilities = (core : pairFirst (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond core))))))))))
manifestClosureByte = (core : pairFirst (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond core)))))))))))
manifestRoots = (core : pairFirst (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond core))))))))))))
manifestExports = (core : pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond core)))))))))))
manifestExports = (core : pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond (pairSecond core))))))))))))
-- Helper: compare a manifest field against an expected byte string.
manifestFieldMatch? = (actual expected : bytesEq? actual expected)