fix(tpv): 修 VKernel 暴露的 codegen 缺陷(浮点 CDefine/__sizeof__ packed/CONST_STR/alloca/无符号/ABI)
- 浮点 t.CDefine 初值序列化与源恢复(gfx PI 编成 0.0) - __sizeof__ 按 packed 计算(cpu _tss memset 越界写 4B) - 数组初始化器支持 CONST_STR 单字符;模块级别名不再产出 global i32 0 假全局 - 临时缓冲/构造临时量 alloca 提升至入口块(B6 未覆盖路径) - 无符号判定补 CSizeT/小写别名/结构体字段 + udiv/urem + range 位宽与符号 + zext 扩展 - 跨模块 declare 形参按 vpi 定义侧收敛(修 _vpi_method_param_annot 拒绝 cls_name=None 导致 coerce 恒失效)
This commit is contained in:
1 parent
bd46b47b22
commit
e20a6f3d11
23 files changed
+655
-101
No files matched your search
@@ -337,9 +337,22 @@ def _normalize_path(path: str) -> str:
|
||||
# 单段 ".":跳过
|
||||
if seg_len == 1 and path[seg_start] == '.':
|
||||
pass
|
||||
# 单段 "..":弹出上一段(无段可弹时保留,如 ../includes)
|
||||
# 单段 "..":弹出上一段;但**前导 ".." 不可弹**,必须保留。
|
||||
# 旧实现只判 out_len > 0 就回退,于是 "无段可弹时保留" 的那一个
|
||||
# 前导 ".." 会被下一个 ".." 当成普通段吃掉:
|
||||
# ./VKernel/../../../includes → 缓冲反复清空 → "./includes"
|
||||
# (cwd 在项目目录时,语义应得 "../../includes")。这正是
|
||||
# ViperOS 各子工程 import 找不到模块的根因。
|
||||
# 与 Python os.path.normpath / TPC 的行为对齐。
|
||||
elif seg_len == 2 and path[seg_start] == '.' and path[seg_start + 1] == '.':
|
||||
if out_len > 0:
|
||||
# 末段是否已经是前导 ".."(独立一段:要么是开头,要么前面是分隔符)
|
||||
last_is_dotdot: int = 0
|
||||
if out_len >= 2 and out[out_len - 1] == '.' and out[out_len - 2] == '.':
|
||||
if out_len == 2:
|
||||
last_is_dotdot = 1
|
||||
elif out[out_len - 3] == '/' or out[out_len - 3] == '\\':
|
||||
last_is_dotdot = 1
|
||||
if out_len > 0 and last_is_dotdot == 0:
|
||||
# 回退到上一个分隔符
|
||||
k: t.CSizeT = out_len
|
||||
while k > 0 and out[k - 1] != '/' and out[k - 1] != '\\':
|
||||
@@ -354,10 +367,13 @@ def _normalize_path(path: str) -> str:
|
||||
else:
|
||||
has_seg = 0
|
||||
else:
|
||||
# 无段可弹:保留 ..
|
||||
out[0] = '.'
|
||||
out[1] = '.'
|
||||
out_len = 2
|
||||
# 没有普通段可弹:把 ".." 当普通段追加(前导 .. 累积保留)
|
||||
if has_seg > 0:
|
||||
out[out_len] = '/'
|
||||
out_len += 1
|
||||
out[out_len] = '.'
|
||||
out[out_len + 1] = '.'
|
||||
out_len += 2
|
||||
has_seg = 1
|
||||
else:
|
||||
# 普通段:追加分隔符 + 段
|
||||
|
||||
Reference in new issue
Block a user