From 9c1cb43c7dee3dbfb142e028516bdb31ca07daa7 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Mon, 23 Feb 2026 12:39:55 -0600 Subject: [PATCH] fix repeated loads --- help.ce | 2 +- internal/engine.cm | 35 ++++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/help.ce b/help.ce index 43ecd431..89cff72c 100644 --- a/help.ce +++ b/help.ce @@ -123,4 +123,4 @@ log.console("") log.console("Run 'cell help ' for more information.") } -$$stop() +$stop() diff --git a/internal/engine.cm b/internal/engine.cm index 5883ad62..3caf2e88 100644 --- a/internal/engine.cm +++ b/internal/engine.cm @@ -2,6 +2,7 @@ // Engine is self-sufficient: defines its own compilation pipeline var ACTORDATA = actorsym var native_mode = false +var _no_warn = (init != null && init.no_warn) ? true : false var SYSYM = '__SYSTEM__' var _cell = {} @@ -52,6 +53,11 @@ function ensure_build_dir() { return dir } +function warn_marker_path(hash) { + if (!shop_path) return null + return shop_path + '/build/' + hash + '.w' +} + // --- Native compilation support --- function detect_host_target() { @@ -158,7 +164,7 @@ function load_pipeline_module(name, env) { compiled = boot_sl(compiled) mcode_json = json.encode(compiled) mach_blob = mach_compile_mcode_bin(name, mcode_json) - if (!native_mode && cached) { + if (cached) { ensure_build_dir() fd.slurpwrite(cached, mach_blob) } @@ -222,6 +228,7 @@ function analyze(src, filename) { var col = null var has_errors = _ast.errors != null && length(_ast.errors) > 0 var folded = null + var _wm = null if (has_errors) { while (_i < length(_ast.errors)) { e = _ast.errors[_i] @@ -242,11 +249,18 @@ function analyze(src, filename) { } folded = fold_mod(_ast) if (!_no_warn && folded._diagnostics != null && length(folded._diagnostics) > 0) { - _i = 0 - while (_i < length(folded._diagnostics)) { - e = folded._diagnostics[_i] - os.print(`${filename}:${text(e.line)}:${text(e.col)}: ${e.severity}: ${e.message}\n`) - _i = _i + 1 + _wm = warn_marker_path(content_hash(stone(blob(src)))) + if (!_wm || !fd.is_file(_wm)) { + _i = 0 + while (_i < length(folded._diagnostics)) { + e = folded._diagnostics[_i] + os.print(`${filename}:${text(e.line)}:${text(e.col)}: ${e.severity}: ${e.message}\n`) + _i = _i + 1 + } + if (_wm) { + ensure_build_dir() + fd.slurpwrite(_wm, stone(blob("1"))) + } } } folded._diagnostics = null @@ -480,8 +494,7 @@ var _init = init if (_init != null && _init.native_mode) native_mode = true -// Inherit warn mode from init (set by C for --no-warn) -var _no_warn = (_init != null && _init.no_warn) ? true : false +// _no_warn already set from init at top of file // CLI path: convert args to init record if (args != null && (_init == null || !_init.program)) { @@ -618,7 +631,9 @@ function use_core(path) { native_path = compile_core_native('core:' + path, file_path) native_handle = os.dylib_open(native_path) result = os.native_module_load_named(native_handle, 'cell_main', env) - } disruption {} + } disruption { + os.print(`[engine] native compilation failed for '${path}'; falling back to bytecode\n`) + } _try_native() if (result != null) { use_cache[cache_key] = result @@ -1732,6 +1747,8 @@ $_.clock(_ => { } env.args = _cell.args.arg env.log = log + os.print(`[debug] env keys: ${text(array(env), ',')}\n`) + os.print(`[debug] $stop in env: ${text(env['$stop'] != null)}\n`) env = stone(env) var native_build = null