From c816f53af45c6bb1e8dac3ea7631412a4a75b10b Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Fri, 16 Oct 2026 12:53:31 +0800 Subject: [PATCH] =?UTF-8?q?chore(mlirlite):=20too-many-elements=20?= =?UTF-8?q?=E5=A4=84=E6=89=93=E5=8D=B0=20n/g/src=20=E5=89=8D=E7=BC=80=20-?= =?UTF-8?q?=20=E5=AE=9A=E4=BD=8D=E5=93=AA=E4=B8=AA=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E8=A2=AB=E6=94=BE=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mlirlite/__module.vp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mlirlite/__module.vp b/mlirlite/__module.vp index 98c6b37..8c0694c 100644 --- a/mlirlite/__module.vp +++ b/mlirlite/__module.vp @@ -929,6 +929,16 @@ def _MlirArrayDenseAt(buf: str, size: sizet, src: str, # 上限只用于防"解析不收敛"的死循环,不是数组容量限制:位图字体表 # `[256] x [16]uint8` 本身就 4352 个元素(外层 256 + 内层 4096),旧值 4096 会误报。 if g > 1048576: + # [DIAG] 元素数冲到上限 ⇒ 直接暴露"是哪个数组、什么形态"(错误诊断增强:正常路径不打印)。 + # 有了这段才能判断是"文本里真的百万元素"还是"解析重复吃同一段"。 + db: str = pool.alloc(200) + if db is not None: + i2: int = 0 + while i2 < 180 and src[i2] != '\0': + db[i2] = src[i2] + i2 += 1 + db[i2] = '\0' + stdio.printf("[MLIR-DIAG] too-many-elements n=%d g=%d src_head=%s\n", n, g, db) MlirFail("MLIR render: too many global array elements") p = _mlir_ws(p) if p[0] == ']':