failsafe boot mode

This commit is contained in:
2026-02-15 11:44:33 -06:00
parent ff80e0d30d
commit ee646db394
22 changed files with 290669 additions and 594234 deletions

View File

@@ -68,6 +68,8 @@ function use_core(path) {
var result = null
var script = null
var ast = null
var mcode_path = null
var mcode_blob = null
// Build env: merge core_extras
env = {use: use_core}
@@ -78,6 +80,26 @@ function use_core(path) {
var mach_blob = null
var source_blob = null
// Check for pre-compiled .cm.mcode JSON IR (generated by regen)
mcode_path = core_path + '/boot/' + replace(path, '/', '_') + '.cm.mcode'
if (fd.is_file(mcode_path)) {
mcode_blob = fd.slurp(mcode_path)
hash = content_hash(mcode_blob)
cached_path = cache_path(hash)
if (cached_path && fd.is_file(cached_path)) {
result = mach_load(fd.slurp(cached_path), env)
} else {
mach_blob = mach_compile_mcode_bin('core:' + path, text(mcode_blob))
if (cached_path) {
ensure_build_dir()
fd.slurpwrite(cached_path, mach_blob)
}
result = mach_load(mach_blob, env)
}
use_cache[cache_key] = result
return result
}
// Compile from source .cm file
var file_path = core_path + '/' + path + MOD_EXT
if (fd.is_file(file_path)) {