faster startup and fix asan error

This commit is contained in:
2026-02-19 03:47:30 -06:00
parent 06ad466b1a
commit 38f368c6d6
5 changed files with 21 additions and 23 deletions

View File

@@ -331,7 +331,10 @@ var wildcard_sinks = []
var warned_channels = {}
var stack_channels = {}
var log_quiet_channels = { shop: true }
function log(name, args) {
if (log_quiet_channels[name]) return
var msg = args[0]
if (msg == null) msg = ""
os.print(`[${text(_cell.id, 0, 5)}] [${name}]: ${msg}\n`)
@@ -559,13 +562,7 @@ log = function(name, args) {
var stack = null
var rec = null
if (!sinks && length(wildcard_sinks) == 0) {
if (!warned_channels[name]) {
warned_channels[name] = true
os.print(`[warn] log channel '${name}' has no sinks configured\n`)
}
return
}
if (!sinks && length(wildcard_sinks) == 0) return
// C-provided stack (from JS_Log callback) overrides caller_info/os.stack
if (c_stack && length(c_stack) > 0) {
@@ -1247,17 +1244,21 @@ $_.clock(_ => {
var pkg = file_info ? file_info.package : null
// Pre-build C modules for all transitive dependencies
// Verify all transitive dependency packages are present
var _deps = null
var _di = 0
if (pkg && shop.ensure_package_dylibs) {
var _dep_dir = null
if (pkg) {
_deps = package.gather_dependencies(pkg)
_di = 0
while (_di < length(_deps)) {
shop.ensure_package_dylibs(_deps[_di])
_dep_dir = package.get_dir(_deps[_di])
if (!fd.is_dir(_dep_dir)) {
log.error('missing dependency package: ' + _deps[_di])
disrupt
}
_di = _di + 1
}
shop.ensure_package_dylibs(pkg)
}
env.use = function(path) {

View File

@@ -34,14 +34,10 @@
static JSClassID js_dylib_class_id;
static void js_dylib_finalizer(JSRuntime *rt, JSValue val) {
void *handle = JS_GetOpaque(val, js_dylib_class_id);
if (handle) {
#ifdef _WIN32
FreeLibrary((HMODULE)handle);
#else
dlclose(handle);
#endif
}
/* Do NOT dlclose here. Loaded dylibs contain finalizer functions for other
JS objects; if the dylib is freed before those objects during
JS_FreeContext teardown, calling their finalizers would SEGV.
The OS reclaims all loaded libraries on process exit. */
}
static JSClassDef js_dylib_class = {

View File

@@ -27,7 +27,7 @@ typedef struct letter {
// #define ACTOR_TRACE
#define ACTOR_FAST_TIMER_NS (10ULL * 1000000) // 10ms per turn
#define ACTOR_SLOW_TIMER_NS (5000ULL * 1000000) // 5s for slow actors
#define ACTOR_SLOW_TIMER_NS (60000ULL * 1000000) // 60s for slow actors
#define ACTOR_SLOW_STRIKES_MAX 3 // consecutive slow turns -> kill
#define ACTOR_MEMORY_LIMIT (16ULL * 1024 * 1024) // 16MB heap cap

View File

@@ -54,6 +54,7 @@ static int rangematch(const char *, char, int, const char **);
int wildmatch(const char *pattern, const char *string, int flags)
{
const char *patternstart = pattern;
const char *stringstart;
const char *newp;
const char *slash;
@@ -87,7 +88,7 @@ int wildmatch(const char *pattern, const char *string, int flags)
c = *pattern;
wild = check_flag(flags, WM_WILDSTAR) && c == '*';
if (wild) {
prev = pattern[-2];
prev = (pattern >= patternstart + 2) ? pattern[-2] : EOS;
/* Collapse multiple stars and slash-** patterns,
* e.g. "** / *** / **** / **" (without spaces)
* is treated as a single ** wildstar.

View File

@@ -76,8 +76,8 @@ return {
c_link_args: []
},
macos_arm64: {
c: 'clang -target arm64-apple-macos11',
cpp: 'clang++ -target arm64-apple-macos11',
c: 'clang -target arm64-apple-macos',
cpp: 'clang++ -target arm64-apple-macos',
ar: 'ar',
strip: 'strip',
system: 'darwin',