ai: stage1 unify IR values and globals

- add spl_ir_value_t (INST/CONST/GLOBAL) and global table
- remove mem.global_alloc and global.ref instructions
- dedup byte constants in a program-level pool
- zero-init aggregate literals in ast2ir; honor undefined
- C backend: fix zero-arg main return, extern prototypes/varargs
- fix dangling inline-module method names (0018 flake)
This commit is contained in:
zzy committed 2026-12-02 22:41:20 +08:00
1 parent 663adf6cae
commit 480945a92f
9 files changed
+1657 -1110

No files matched your search

+5 -1
View File
@@ -969,7 +969,11 @@ static spl_def_id_t sema_build_inline_prefixes(spl_sema_t *sema, const char *pat
sema->ast, 0);
}
spl_def_id_t prefix_def = node->owner_id;
sema_ns_aggregate_add_method(sema, prefix_def, segs.data[i], child_def);
/* segs 指向临时 buf,方法名必须引用生命周期更长的命名空间名。 */
spl_ns_id_t child_ns = spl_ns_child(sema->ns, prefix_ns, segs.data[i]);
const char *method_name =
child_ns ? vec_at(sema->ns->nodes, child_ns).name : segs.data[i];
sema_ns_aggregate_add_method(sema, prefix_def, method_name, child_def);
child_def = prefix_def;
}