Merge branch 'fix_compile_warnings'

This commit is contained in:
2026-02-20 15:34:50 -06:00
40 changed files with 282 additions and 312 deletions

View File

@@ -5,7 +5,7 @@ var fd = use("fd")
var os = use("internal/os")
if (length(args) < 1) {
print("usage: cell --dev --seed run_native_seed <module>")
log.compile("usage: cell --dev --seed run_native_seed <module>")
disrupt
}
@@ -24,29 +24,29 @@ if (length(args) > 1) {
}
// --- Interpreted run ---
print("--- interpreted ---")
log.compile("--- interpreted ---")
var t1 = os.now()
var mod_interp = use(name)
var t2 = os.now()
var result_interp = null
if (is_function(mod_interp)) {
print("module returns a function, calling with " + text(test_arg))
log.compile("module returns a function, calling with " + text(test_arg))
t1 = os.now()
result_interp = mod_interp(test_arg)
t2 = os.now()
}
result_interp = result_interp != null ? result_interp : mod_interp
var ms_interp = (t2 - t1) / 1000000
print("result: " + text(result_interp))
print("time: " + text(ms_interp) + " ms")
log.compile("result: " + text(result_interp))
log.compile("time: " + text(ms_interp) + " ms")
// --- Native run ---
if (!fd.is_file(dylib_path)) {
print("\nno " + dylib_path + " found")
log.error("\nno " + dylib_path + " found")
disrupt
}
print("\n--- native ---")
log.compile("\n--- native ---")
var t3 = os.now()
var lib = os.dylib_open(dylib_path)
var t4 = os.now()
@@ -54,7 +54,7 @@ var mod_native = os.dylib_symbol(lib, symbol)
var t5 = os.now()
var result_native = null
if (is_function(mod_native)) {
print("module returns a function, calling with " + text(test_arg))
log.compile("module returns a function, calling with " + text(test_arg))
t4 = os.now()
result_native = mod_native(test_arg)
t5 = os.now()
@@ -62,17 +62,17 @@ if (is_function(mod_native)) {
result_native = result_native != null ? result_native : mod_native
var ms_native = (t5 - t3) / 1000000
var ms_exec = (t5 - t4) / 1000000
print("result: " + text(result_native))
print("load: " + text((t4 - t3) / 1000000) + " ms")
print("exec: " + text(ms_exec) + " ms")
print("total: " + text(ms_native) + " ms")
log.compile("result: " + text(result_native))
log.compile("load: " + text((t4 - t3) / 1000000) + " ms")
log.compile("exec: " + text(ms_exec) + " ms")
log.compile("total: " + text(ms_native) + " ms")
// --- Comparison ---
print("\n--- comparison ---")
print("match: " + text(result_interp == result_native))
log.compile("\n--- comparison ---")
log.compile("match: " + text(result_interp == result_native))
if (ms_native > 0) {
print("speedup: " + text(ms_interp / ms_native) + "x (total)")
log.compile("speedup: " + text(ms_interp / ms_native) + "x (total)")
}
if (ms_exec > 0) {
print("speedup: " + text(ms_interp / ms_exec) + "x (exec only)")
log.compile("speedup: " + text(ms_interp / ms_exec) + "x (exec only)")
}