chore(detsite): 类型文本 4096 缓冲补插桩
19 处 TypePrint(..., 4096, ...) 对应的 pool.alloc(4096) 全部改用 alloc_tagged (AssignGenMixin/ClassGenVTable/FuncGenDef/ExprGenBase/ExprGenCdef/CallGenLeafKit/ TypeGenCType/TypeGenResolve/CallGenCBuiltin/ExprGenOps),tag 33..51 见 memhub.vp。 detection==0 时 alloc_tagged 直接转发,无布局与性能变化。
This commit is contained in:
1 parent
f3628a797a
commit
edca6c3760
10 files changed
+16
-16
No files matched your search
@@ -575,8 +575,8 @@ novirtual class AssignGenMixin:
|
||||
if ta is None or tb is None: return 0
|
||||
# Fast path: identical instance is equal
|
||||
if uint64(ta) == uint64(tb): return 1
|
||||
buf_a: str = pool.alloc(4096)
|
||||
buf_b: str = pool.alloc(4096)
|
||||
buf_a: str = pool.alloc_tagged(4096, memhub.DETSITE_ASSIGNGEN_578)
|
||||
buf_b: str = pool.alloc_tagged(4096, memhub.DETSITE_ASSIGNGEN_579)
|
||||
if buf_a is None or buf_b is None: return 0
|
||||
mlirlite.TypePrint(buf_a, 4096, ta, pool)
|
||||
mlirlite.TypePrint(buf_b, 4096, tb, pool)
|
||||
|
||||
@@ -1147,7 +1147,7 @@ novirtual class CallGenCBuiltin(CallGenBase.CallGenBase):
|
||||
first_arg = 0
|
||||
|
||||
# Type text
|
||||
ty_buf: str = pool.alloc(4096)
|
||||
ty_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_CALLGENCBUILTIN_1150)
|
||||
if ty_buf is not None:
|
||||
ty_buf[0] = '\0'
|
||||
mlirlite.TypePrint(ty_buf, 4096, aval.Ty, pool)
|
||||
@@ -1173,7 +1173,7 @@ novirtual class CallGenCBuiltin(CallGenBase.CallGenBase):
|
||||
builder.Counter += 1
|
||||
|
||||
# Get the return type text
|
||||
ret_ty_buf: str = pool.alloc(4096)
|
||||
ret_ty_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_CALLGENCBUILTIN_1176)
|
||||
if ret_ty_buf is not None:
|
||||
ret_ty_buf[0] = '\0'
|
||||
mlirlite.TypePrint(ret_ty_buf, 4096, ret_ty, pool)
|
||||
|
||||
@@ -536,7 +536,7 @@ novirtual class CallGenLeafKit(CallGenCBuiltin.CallGenCBuiltin):
|
||||
cap: int = CallGenBase.MAX_FUNC_PTR_SIGS
|
||||
ret_str: str = "?"
|
||||
if ret_ty is not None:
|
||||
typed_buf: str = pool.alloc(4096)
|
||||
typed_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_LEAFKIT_539)
|
||||
if typed_buf is not None:
|
||||
mlirlite.TypePrint(typed_buf, 4096, ret_ty, pool)
|
||||
if typed_buf[0] != '\0': ret_str = typed_buf
|
||||
|
||||
@@ -816,7 +816,7 @@ novirtual class ClassGenVTable(ClassGenBase.ClassGenBase):
|
||||
else:
|
||||
# fail-fast: has a -> annotation but control truly falls off the end (traceback-style).
|
||||
if ret_ty is not None:
|
||||
rt_name_m: str = pool.alloc(4096)
|
||||
rt_name_m: str = pool.alloc_tagged(4096, memhub.DETSITE_CLASSGENVTABLE_819)
|
||||
if rt_name_m is not None:
|
||||
mlirlite.TypePrint(rt_name_m, 4096, ret_ty, pool)
|
||||
if rt_name_m[0] == '\0': rt_name_m = "?"
|
||||
|
||||
@@ -412,7 +412,7 @@ novirtual class ExprGenBase:
|
||||
def _type_text(self, pool: memhub.MemBuddy*, ty: mlirlite.LLVMType*) -> str:
|
||||
"""Readable LLVM type text via TypePrint; "?" on failure."""
|
||||
if ty is None: return "?"
|
||||
buf: str = pool.alloc(4096)
|
||||
buf: str = pool.alloc_tagged(4096, memhub.DETSITE_EXPRGENBASE_415)
|
||||
if buf is None: return "?"
|
||||
mlirlite.TypePrint(buf, 4096, ty, pool)
|
||||
if buf[0] == 0: return "?"
|
||||
|
||||
@@ -260,7 +260,7 @@ novirtual class ExprGenCdef(ExprGenBase.ExprGenBase):
|
||||
if src_path is None:
|
||||
# SHA1 absent from the store = compiler bug (Phase1/Phase2 not populated):
|
||||
# report and abort instead of silently returning -1 (avoids bad @UNDEFINED refs).
|
||||
err_buf: str = pool.alloc(4096)
|
||||
err_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_EXPRGENCDEF_263)
|
||||
if err_buf is not None:
|
||||
viperlib.snprintf(err_buf, 512, "cross-module CDefine lookup failed: SHA1 %s is not in the store (base_mod=%s name=%s). " "Phase1/Phase2 did not correctly populate PopulateSha1MapStore/AppendToSha1MapStore", sha1, base_mod, name)
|
||||
VLogger.error(err_buf, "XMOD-CD")
|
||||
|
||||
@@ -497,8 +497,8 @@ novirtual class ExprGenOps(ExprGenBase.ExprGenBase):
|
||||
rhs_is_ptr_now: int = self.is_ptr_type(rhs.Ty)
|
||||
if lhs_is_ptr_now != 0 and rhs_is_ptr_now != 0:
|
||||
# Both are pointers; compare type strings via TypePrint
|
||||
lhs_ty_buf: str = pool.alloc(4096)
|
||||
rhs_ty_buf: str = pool.alloc(4096)
|
||||
lhs_ty_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_EXPRGENOPS_500)
|
||||
rhs_ty_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_EXPRGENOPS_501)
|
||||
if lhs_ty_buf is not None and rhs_ty_buf is not None:
|
||||
mlirlite.TypePrint(lhs_ty_buf, 4096, lhs.Ty, pool)
|
||||
mlirlite.TypePrint(rhs_ty_buf, 4096, rhs.Ty, pool)
|
||||
@@ -1056,8 +1056,8 @@ novirtual class ExprGenOps(ExprGenBase.ExprGenBase):
|
||||
# Augmented assignment: build the "+=" form with an f-string (this language's str has no `+` concatenation).
|
||||
op_lbl = f"{op_ch}="
|
||||
aug_note = "(augmented assignment)"
|
||||
lty_buf: str = pool.alloc(4096)
|
||||
rty_buf: str = pool.alloc(4096)
|
||||
lty_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_EXPRGENOPS_1059)
|
||||
rty_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_EXPRGENOPS_1060)
|
||||
lty_lbl: str = "?"
|
||||
rty_lbl: str = "?"
|
||||
if lty_buf is not None:
|
||||
|
||||
@@ -789,7 +789,7 @@ novirtual class FuncGenDef(CallGenBase.CallGenBase):
|
||||
if ret_ty is not None:
|
||||
# mlirlite has no type_get_name API; serialize the type with the real interface
|
||||
# TypePrint(buf, size, ty, pool).
|
||||
rt_name: str = pool.alloc(4096)
|
||||
rt_name: str = pool.alloc_tagged(4096, memhub.DETSITE_FUNCGENDEF_792)
|
||||
if rt_name is not None:
|
||||
mlirlite.TypePrint(rt_name, 4096, ret_ty, pool)
|
||||
if rt_name[0] == '\0': rt_name = "?"
|
||||
|
||||
@@ -422,7 +422,7 @@ class TypeGenCType(TypeGenBase.TypeGenBase):
|
||||
# line parse buffer ("NAME\0VALUE\0"), reused per file (register_ctypedef copies).
|
||||
# 512 (not 320): _parse_typedef_line normalizes a C-style RHS (`const T` / `T*`) into
|
||||
# the longer canonical `|` union text, so the VALUE area must hold the expanded form.
|
||||
td_buf: str = pool.alloc(4096)
|
||||
td_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_TYPEGENCTYPE_425)
|
||||
for i in range(src_len + 1):
|
||||
if i == src_len or src[i] == '\n':
|
||||
line_len: sizet = i - line_start
|
||||
|
||||
@@ -557,7 +557,7 @@ novirtual class TypeGenResolve(TypeGenBase.TypeGenBase):
|
||||
# 4) Symbol-name truth: the struct's own IR name is "{module SHA1}.{Class}"
|
||||
# (same mangling as everywhere), so recover the SHA1 from the type name.
|
||||
if _def_sha1 is None and _bare_entry is not None and _bare_entry.Ty is not None:
|
||||
_tp_buf: str = pool.alloc(4096)
|
||||
_tp_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_TYPEGENRESOLVE_560)
|
||||
if _tp_buf is not None:
|
||||
_tp_buf[0] = '\0'
|
||||
mlirlite.TypePrint(_tp_buf, 4096, _bare_entry.Ty, pool)
|
||||
@@ -607,7 +607,7 @@ novirtual class TypeGenResolve(TypeGenBase.TypeGenBase):
|
||||
if _bare_entry is not None: _w_ep = 1
|
||||
_w_ty: str = "None"
|
||||
if _bare_entry is not None and _bare_entry.Ty is not None:
|
||||
_w_buf: str = pool.alloc(4096)
|
||||
_w_buf: str = pool.alloc_tagged(4096, memhub.DETSITE_TYPEGENRESOLVE_610)
|
||||
if _w_buf is not None:
|
||||
_w_buf[0] = '\0'
|
||||
mlirlite.TypePrint(_w_buf, 4096, _bare_entry.Ty, pool)
|
||||
|
||||
Reference in new issue
Block a user