AotPrep collections_hot matmul tuning and bench tweaks

This commit is contained in:
nyash-codex
2025-11-14 13:36:20 +09:00
parent 13f21334c9
commit f1fa182a4b
17 changed files with 760 additions and 219 deletions

View File

@ -427,6 +427,75 @@ static box Main {
if bundles.length() > 0 || bundle_srcs.length() > 0 || require_mods.length() > 0 {
local merged_prefix = BundleResolver.resolve(bundles, bundle_names, bundle_srcs, require_mods)
if merged_prefix == null { return 1 }
// Debug: emit line-map for merged bundles so parse error line can be mapped
{
local dbg = env.get("HAKO_STAGEB_DEBUG")
if dbg != null && ("" + dbg) == "1" {
// Count lines helper (inline)
local total = 0
{
local s2 = merged_prefix
if s2 == null { total = 0 } else {
local i=0; local n=(""+s2).length(); local c=1
loop(i<n){ if (""+s2).substring(i,i+1)=="\n" { c=c+1 } i=i+1 }
total = c
}
}
print("[stageb/line-map] prefix total lines=" + total)
// bundle-src (anonymous)
if bundles != null && bundles.length() > 0 {
local i = 0; local acc = 1
loop(i < bundles.length()) {
local seg = "" + bundles.get(i)
local ln = 0
{
local s2 = seg
if s2 == null { ln = 0 } else {
local ii=0; local nn=(""+s2).length(); local cc=1
loop(ii<nn){ if (""+s2).substring(ii,ii+1)=="\n" { cc=cc+1 } ii=ii+1 }
ln = cc
}
}
local start = acc
local finish = acc + ln - 1
print("[stageb/line-map] bundle-src[#" + i + "] " + start + ".." + finish)
acc = finish + 1
i = i + 1
}
}
// bundle-mod (named)
if bundle_names != null && bundle_srcs != null {
local i2 = 0; local acc2 = 1
if bundles != null {
// count lines of joined bundle-src
local joined = bundles.join("\n")
if joined == null { acc2 = 1 } else {
local ii=0; local nn=(""+joined).length(); local cc=1
loop(ii<nn){ if (""+joined).substring(ii,ii+1)=="\n" { cc=cc+1 } ii=ii+1 }
acc2 = cc + 1
}
}
loop(i2 < bundle_srcs.length()) {
local name = "" + bundle_names.get(i2)
local seg = "" + bundle_srcs.get(i2)
local ln = 0
{
local s2 = seg
if s2 == null { ln = 0 } else {
local ii=0; local nn=(""+s2).length(); local cc=1
loop(ii<nn){ if (""+s2).substring(ii,ii+1)=="\n" { cc=cc+1 } ii=ii+1 }
ln = cc
}
}
local start = acc2
local finish = acc2 + ln - 1
print("[stageb/line-map] bundle-mod[name=" + name + "] " + start + ".." + finish)
acc2 = finish + 1
i2 = i2 + 1
}
}
}
}
body_src = merged_prefix + body_src
}