stage2 修复大量AI生成的风格问题 stage1 修复对于vm abi的错误生成

This commit is contained in:
zzy committed 2026-10-03 15:05:55 +08:00
1 parent 0e38858785
commit 76f980654c
40 files changed
+619 -938

No files matched your search

+4 -9
View File
@@ -1,9 +1,7 @@
// Expect retcode = 0
// 目标布局(移植自 stage1/spl_layout.c)。输入是 IR 类型表 TypeTable;
// 为每个类型计算 size_bits / align_bits / 字段位偏移,供 ir2vm 使用。
// 默认 64 位平台:标量按 1/2/4/8 字节对齐,指针 = usize,聚合按最大字段对齐
// 且不允许重排(与 stage1 的默认策略一致)。
// 目标布局:由 IR 类型表计算 size/align/字段位偏移,供 ir2vm 使用。默认 64 位平台,
// 聚合按最大字段对齐且不重排。
type .{ .Error } = @import("utils/error.spl");
type .{ .Vec } = @import("utils/vec.spl");
@@ -47,7 +45,7 @@ fn info_at(self: *Layout, id: usize): *LayoutInfo {
ret (self.infos.data as *LayoutInfo) + id;
}
// 未解析或越界返回 null(对应 stage1 spl_layout_info_of)。
// 未解析或越界返回 null。
fn info_of(self: *Layout, id: usize): *LayoutInfo {
var info = info_at(self, id);
if info == null || !info.resolved { ret null; }
@@ -84,10 +82,7 @@ fn ensure(self: *Layout, n: usize) {
}
fn push_usize(v: *Vec, x: usize) {
match Vec.push(v, &x as *u8) {
.Ok => {},
.Err(error) => {},
}
Vec.push(v, &x as *u8);
}
fn usize_at(v: *Vec, i: usize): usize {