progress on aot

This commit is contained in:
2026-02-16 21:58:45 -06:00
parent a1ee7dd458
commit 4b7cde9400
13 changed files with 789 additions and 421 deletions

View File

@@ -22,6 +22,9 @@ function use_embed(name) {
return load_internal("js_core_" + name + "_use")
}
// These duplicate C builtins from runtime.c, but are needed because the GC can
// lose properties on the global object after compaction. The runtime_env provides
// a stable way for modules to access them via env_record linking.
function logical(val1) {
if (val1 == 0 || val1 == false || val1 == "false" || val1 == null)
return false;
@@ -101,7 +104,7 @@ function load_pipeline_module(name, env) {
}
// Load compilation pipeline
var pipeline_env = {use: use_embed}
var pipeline_env = stone({use: use_embed})
var tokenize_mod = load_pipeline_module('tokenize', pipeline_env)
var parse_mod = load_pipeline_module('parse', pipeline_env)
var fold_mod = load_pipeline_module('fold', pipeline_env)
@@ -222,6 +225,7 @@ function use_core(path) {
// Build env: merge core_extras
env = {use: use_core}
arrfor(array(core_extras), function(k) { env[k] = core_extras[k] })
env = stone(env)
var hash = null
var cached_path = null
@@ -398,7 +402,9 @@ var parallel = pronto.parallel
var race = pronto.race
var sequence = pronto.sequence
// Fill runtime_env (same object reference shop holds)
// Fill runtime_env — includes duplicates of C builtins because the GC can
// lose global object properties after compaction. Modules resolve these via
// env_record, not the global.
runtime_env.logical = logical
runtime_env.some = some
runtime_env.every = every
@@ -1045,6 +1051,7 @@ $_.clock(_ => {
}
env.args = _cell.args.arg
env.log = log
env = stone(env)
var source_blob = fd.slurp(prog_path)
var hash = content_hash(source_blob)