fix(gi): 模块级类全局按值本位存储(仅 __new__ 类用指针) - 修 CAM: V3 被包成 Ptr 致悬垂误报
This commit is contained in:
1 parent
9d0a43d5e6
commit
5460d78ff1
2 files changed
+11
-4
No files matched your search
@@ -2885,10 +2885,10 @@ def _inject_global_variable_declare(pool: memhub.MemBuddy*, mod: mlirlite.LLVMMo
|
||||
gv_ty_v: mlirlite.LLVMType* = resolved_v
|
||||
match resolved_v:
|
||||
case mlirlite.LLVMType.Struct(_, _, _):
|
||||
# Object classes (@t.Object/@t.CVTable: object-as-pointer) -> Ptr(struct), matching
|
||||
# handle_module_level_var; plain t.CStruct value classes keep a value instance.
|
||||
# 与 handle_module_level_var 保持同一口径:只有 `__new__`(自定义分配)的类才以指针表示;
|
||||
# 仅"有方法 / 带 vtable"(IsOOP / HasVTable)的类,模块级全局同样按值本位存储。
|
||||
gv_entry_v: GenTypes.StructEntry* = GenApi.find_struct_by_type(resolved_v)
|
||||
if gv_entry_v is not None and (gv_entry_v.HasNew != 0 or gv_entry_v.HasVTable != 0 or gv_entry_v.IsOOP != 0): gv_ty_v = mlirlite.Ptr(pool, resolved_v)
|
||||
if gv_entry_v is not None and gv_entry_v.HasNew != 0: gv_ty_v = mlirlite.Ptr(pool, resolved_v)
|
||||
else: gv_ty_v = resolved_v
|
||||
case mlirlite.LLVMType.Array(aelem_v, acount_v):
|
||||
# Fixed-size arrays (CArray[T, N]) keep the full [N x T] type, matching
|
||||
|
||||
Reference in new issue
Block a user