fix(narrow): ClassGenBase 方法元数据指针声明 int* 而非 t.CPtr

flags_ptr/flags_ptr2 被显式 (int*)(...) 赋值但声明为 t.CPtr,下标元素被判为 i8,与 i*4 的 32 位步长及位标志语义不符(且 >127 的值会读出符号错误);声明改为 int*
This commit is contained in:
TermiNexus committed 2026-10-11 10:04:19 +08:00
1 parent 3b9deb08d8
commit 985983391b
1 file changed
+3 -3
+3 -3
View File
@@ -631,7 +631,7 @@ novirtual class ClassGenBase:
i: int
for i in range(self.MethodMetaCount):
if string.strcmp(self.MethodMetaKeys + i * META_KEY_LEN, key_buf) == 0:
flags_ptr: t.CPtr = (int*)(uint64(self.MethodMetaFlags) + i * 4)
flags_ptr: int* = (int*)(uint64(self.MethodMetaFlags) + i * 4)
# OR-combine flags: a getter then setter/deleter registers repeatedly,
# so whole-value replacement would drop GETTER and crash downstream mlirlite.
flags_ptr[0] = flags_ptr[0] | meta
@@ -640,7 +640,7 @@ novirtual class ClassGenBase:
if self.MethodMetaCount < META_MAX:
# Slot is META_KEY_LEN=128 bytes; clamp strncpy to avoid overflowing the next slot.
string.strncpy(self.MethodMetaKeys + self.MethodMetaCount * META_KEY_LEN, key_buf, META_KEY_LEN - 1)
flags_ptr2: t.CPtr = (int*)(uint64(self.MethodMetaFlags) + self.MethodMetaCount * 4)
flags_ptr2: int* = (int*)(uint64(self.MethodMetaFlags) + self.MethodMetaCount * 4)
flags_ptr2[0] = meta
self.MethodMetaCount += 1
stdlib.free(key_buf)
@@ -657,7 +657,7 @@ novirtual class ClassGenBase:
i: int
for i in range(self.MethodMetaCount):
if string.strcmp(self.MethodMetaKeys + i * META_KEY_LEN, key_buf) == 0:
flags_ptr: t.CPtr = (int*)(uint64(self.MethodMetaFlags) + i * 4)
flags_ptr: int* = (int*)(uint64(self.MethodMetaFlags) + i * 4)
found = flags_ptr[0]
break
stdlib.free(key_buf)