fix(compiler,peephole): TPC 属性链解析与窥孔输出瘦身

- TPC(lib/core): 任意级属性链按链前向类解析恢复 stub 退化字段; cast 局部 rowptr[X] 登记回填; 通用指针槽按静态类名 bitcast 兜底; 赋值 RHS 求值失败 fail-fast 防未初始化变量; 报错行按源码文本锚定并附 ATTR-DIAG 现场
- 窥孔(includes/llvmlite/__function.vp): 成员访问单级链模式; 窥孔移至 Renumber 前使 SSA 编号连续; T3 no-op bitcast 消除; 替换缓冲按最坏上界分配
- __builder/__module/string.vp 配套; 清理 Test 构建产物与 PROF 杂项
This commit is contained in:
TermiNexus committed 2026-09-08 11:02:37 +08:00
1 parent 45e78ad107
commit 76d1ee6076
173 files changed
+1104 -3090

No files matched your search

+13 -14
View File
@@ -1,16 +1,16 @@
6394599d6a61cabf:includes/ast/__init__.vp
001947a1f780bd5f:includes/builtins.vp
f5522571bcce7bcb:includes/stdint.vp
7e4672b992208969:includes/memhub.vp
b8970f3b6886efa6:includes/string.vp
eb09ac7f10988a63:includes/ast/tokens.vp
e9dfb296a8674aee:includes/ast/base.vp
4618d74293c6746a:includes/ast/stmts.vp
c0def010dcebadb1:includes/ast/exprs.vp
34dc6a647fa19b7b:includes/ast/astaux.vp
3b2a307c9c7d0129:includes/ast/match.vp
43ee0269efffadc3:includes/ast/lexer.vp
df83e214ee82d0f3:includes/ast/parser.vp
3571eabe5a83d798:includes/ast/__init__.vp
50b9991a98ff2dd5:includes/builtins.vp
d856ba5f6f074f04:includes/stdint.vp
1819d836dcee9afa:includes/memhub.vp
4a42e6e4a0818b1e:includes/string.vp
3c774069d112cc3f:includes/ast/tokens.vp
7565e081d88517ac:includes/ast/base.vp
ebe3b1f219d7b887:includes/ast/stmts.vp
12bc7ec9063821df:includes/ast/exprs.vp
7ebdc3bbda127a46:includes/ast/astaux.vp
ad445c65d2ac295a:includes/ast/match.vp
58d97de24b40f9dc:includes/ast/lexer.vp
269b410a8b96c1f5:includes/ast/parser.vp
aa246c6e6aa30484:includes/atom.vp
2c175afd85852faf:includes/viperio.vp
09c0472e6fd0d088:includes/stdio.vp
@@ -18,4 +18,3 @@ aa246c6e6aa30484:includes/atom.vp
e94ef9e139461915:includes/_list.vp
95a546a38b5b6316:includes/viperlib.vp
cf900a640e6eeff3:includes/stdarg.vp
0ef89e1f17596302:main.vp
@@ -1 +0,0 @@
t
Whitespace-only changes.
@@ -1,23 +0,0 @@
"""
Auto-generated Python stub file from stdio.vp
Module: stdio
"""
import t, c
def printf(fmt: t.CConst | str, *args) -> int | t.State: pass
def fprintf(stream: bytes, fmt: t.CConst | str, *args) -> int | t.State: pass
def sprintf(buf: bytes, fmt: t.CConst | str, *args) -> int | t.State: pass
def snprintf(buf: bytes, size: t.CSizeT, fmt: t.CConst | str, *args) -> int | t.State: pass
def puts(s: t.CConst | str) -> int | t.State: pass
def fputs(s: t.CConst | str, stream: bytes) -> int | t.State: pass
def fgets(buf: bytes, size: int, stream: bytes) -> bytes | t.State: pass
def fflush(stream: bytes) -> int | t.State: pass
@@ -1 +0,0 @@
{}
@@ -1,19 +0,0 @@
"""
Auto-generated Python stub file from main.vp
Module: main
"""
import c
import t
import ast
class Result:
__slots__ = ('elem_type_node', 'count_node', 'is_pointer')
def __init__(self: Result, elem: ast.AST, count: ast.AST | t.CPtr, flag: bool) -> None: pass
elem_type_node: ast.AST
count_node: ast.AST | t.CPtr
is_pointer: bool
def main() -> int: pass
@@ -1 +0,0 @@
f5522571bcce7bcb
@@ -1,22 +0,0 @@
"""
Auto-generated Python stub file from stdlib.vp
Module: stdlib
"""
import c
from stdint import *
import t
def malloc(size: t.CSizeT) -> t.CVoid | t.CPtr | t.State: pass
def calloc(nmemb: t.CSizeT, size: t.CSizeT) -> t.CVoid | t.CPtr | t.State: pass
def realloc(p: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CVoid | t.CPtr | t.State: pass
def free(p: t.CVoid | t.CPtr) -> t.State: pass
def system(cmd: t.CConst | t.CChar | t.CPtr) -> INT | t.State: pass
def exit(status: int) -> t.State: pass
Whitespace-only changes.
@@ -1,20 +0,0 @@
"""
Auto-generated Python stub file from stdarg.vp
Module: stdarg
"""
import c
import t
def va_start(args: t.CPtr, last_arg: t.CPtr) -> t.State: pass
def va_arg(args: t.CPtr, type: t.CPtr) -> t.CPtr | t.State: pass
def va_end(args: t.CPtr) -> t.State | t.State: pass
va_list: t.CTypedef = t.CUnsignedChar | t.CPtr
def arg(type: t.CType) -> t.State: pass
@@ -1 +0,0 @@
{"d:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\SlotsBugTest\\App\\main.vp": {"sha1": "44bd5632a417f7ac", "mtime": 1784741370.3609664, "size": 714}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\__init__.vp": {"sha1": "876e256c06636777", "mtime": 1786370438.7959065, "size": 3919}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\astaux.vp": {"sha1": "34dc6a647fa19b7b", "mtime": 1786033586.0642571, "size": 11475}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\base.vp": {"sha1": "71b20381eda0450a", "mtime": 1786370425.011384, "size": 16357}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\exprs.vp": {"sha1": "43ec967d0517abc1", "mtime": 1786370434.0783823, "size": 40976}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\lexer.vp": {"sha1": "d0072d5282b9b65f", "mtime": 1786095601.8036606, "size": 24838}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\match.vp": {"sha1": "3b2a307c9c7d0129", "mtime": 1786095636.9718795, "size": 12297}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\parser.vp": {"sha1": "ee85a98dc101e131", "mtime": 1786533765.2045004, "size": 102005}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\stmts.vp": {"sha1": "46ea1349c980c7f4", "mtime": 1786369520.4458838, "size": 38239}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\ast\\tokens.vp": {"sha1": "cea844466f10ac61", "mtime": 1786196689.3449256, "size": 14506}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\atom.vp": {"sha1": "aa246c6e6aa30484", "mtime": 1785389628.701967, "size": 1198}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\memhub.vp": {"sha1": "2408ce147bac090b", "mtime": 1786323167.9697752, "size": 33121}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdarg.vp": {"sha1": "71e0a3ffcb3ebfad", "mtime": 1781258888.113146, "size": 277}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdint.vp": {"sha1": "f5522571bcce7bcb", "mtime": 1785563642.3805652, "size": 4356}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdio.vp": {"sha1": "285b6aa29a34754d", "mtime": 1785332415.1829746, "size": 561}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdlib.vp": {"sha1": "6c658cc728d0bbf4", "mtime": 1785750602.5446548, "size": 413}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\string.vp": {"sha1": "40b053f21c0df07c", "mtime": 1786533758.705974, "size": 11985}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\viperio.vp": {"sha1": "2c175afd85852faf", "mtime": 1786320035.0415876, "size": 1685}, "d:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\viperlib.vp": {"sha1": "bba983c61a970f7c", "mtime": 1786320034.4835327, "size": 59458}}
-19
View File
@@ -1,19 +0,0 @@
2408ce147bac090b:includes/memhub.vp
285b6aa29a34754d:includes/stdio.vp
2c175afd85852faf:includes/viperio.vp
34dc6a647fa19b7b:includes/ast\astaux.vp
3b2a307c9c7d0129:includes/ast\match.vp
40b053f21c0df07c:includes/string.vp
43ec967d0517abc1:includes/ast\exprs.vp
44bd5632a417f7ac:main.vp
46ea1349c980c7f4:includes/ast\stmts.vp
6c658cc728d0bbf4:includes/stdlib.vp
71b20381eda0450a:includes/ast\base.vp
71e0a3ffcb3ebfad:includes/stdarg.vp
876e256c06636777:includes/ast\__init__.vp
aa246c6e6aa30484:includes/atom.vp
bba983c61a970f7c:includes/viperlib.vp
cea844466f10ac61:includes/ast\tokens.vp
d0072d5282b9b65f:includes/ast\lexer.vp
ee85a98dc101e131:includes/ast\parser.vp
f5522571bcce7bcb:includes/stdint.vp
Whitespace-only changes.
@@ -1,26 +0,0 @@
"""
Auto-generated Python stub file from atom.vp
Module: atom
"""
import t, c
ATOMIC_RELAXED: t.CDefine = 0
ATOMIC_CONSUME: t.CDefine = 1
ATOMIC_ACQUIRE: t.CDefine = 2
ATOMIC_RELEASE: t.CDefine = 3
ATOMIC_ACQ_REL: t.CDefine = 4
ATOMIC_SEQ_CST: t.CDefine = 5
def __atomic_test_and_set(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CBool: pass
def __atomic_clear(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CVoid: pass
def __atomic_thread_fence(order: t.CInt) -> t.CVoid: pass
def __atomic_signal_fence(order: t.CInt) -> t.CVoid: pass
def __atomic_always_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool: pass
def __atomic_is_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool: pass
Whitespace-only changes.
-100
View File
@@ -1,100 +0,0 @@
"""
Auto-generated Python stub file from stdint.vp
Module: stdint
"""
import c
import t
INT: t.CTypedef = t.CInt
INTPTR: t.CTypedef = t.CInt | t.CPtr
BOOL: t.CTypedef = t.CInt
UINT: t.CTypedef = t.CUnsignedInt
UINTPTR: t.CTypedef = UINT | t.CPtr
BYTE: t.CTypedef = t.CUnsignedChar
BYTEPTR: t.CTypedef = BYTE | t.CPtr
WORD: t.CTypedef = t.CUInt16T
DWORD: t.CTypedef = t.CUInt32T
QWORD: t.CTypedef = t.CUInt64T
TCHAR: t.CTypedef = t.CChar
CHARLIST: t.CTypedef = str | t.CPtr
VOID: t.CTypedef = t.CVoid
SHORT: t.CTypedef = t.CShort
SHORTPTR: t.CTypedef = t.CShort | t.CPtr
USHORT: t.CTypedef = t.CUnsignedShort
USHORTPTR: t.CTypedef = t.CUnsignedShort | t.CPtr
LONGLONG: t.CTypedef = t.CLongLong
ULONGLONG: t.CTypedef = t.CUnsignedLongLong
LONG: t.CTypedef = t.CLong
ULONG: t.CTypedef = t.CUnsignedLong
WCHAR: t.CTypedef = WORD
WCHARPTR: t.CTypedef = WORD | t.CPtr
CHARPTR: t.CTypedef = t.CChar | t.CPtr
FSIZE_t: t.CTypedef = DWORD
LBA_t: t.CTypedef = DWORD
VOIDPTR: t.CTypedef = t.CVoid | t.CPtr
FLOAT: t.CTypedef = t.CFloat
DOUBLE: t.CTypedef = t.CDouble
FLOAT8: t.CTypedef = t.CFloat8T
FLOAT16: t.CTypedef = t.CFloat16T
FLOAT32: t.CTypedef = t.CFloat32T
FLOAT64: t.CTypedef = t.CFloat64T
FLOAT128: t.CTypedef = t.CFloat128T
INT8: t.CTypedef = t.CInt8T
INT16: t.CTypedef = t.CInt16T
INT32: t.CTypedef = t.CInt32T
INT64: t.CTypedef = t.CInt64T
UINT8: t.CTypedef = t.CUInt8T
UINT16: t.CTypedef = t.CUInt16T
UINT32: t.CTypedef = t.CUInt32T
UINT64: t.CTypedef = t.CUInt64T
INT8PTR: t.CTypedef = t.CInt8T | t.CPtr
INT16PTR: t.CTypedef = t.CInt16T | t.CPtr
INT32PTR: t.CTypedef = t.CInt32T | t.CPtr
INT64PTR: t.CTypedef = t.CInt64T | t.CPtr
UINT8PTR: t.CTypedef = t.CUInt8T | t.CPtr
UINT16PTR: t.CTypedef = t.CUInt16T | t.CPtr
UINT32PTR: t.CTypedef = t.CUInt32T | t.CPtr
UINT64PTR: t.CTypedef = t.CUInt64T | t.CPtr
CHAR8: t.CTypedef = t.CChar8T
CHAR16: t.CTypedef = t.CChar16T
CHAR32: t.CTypedef = t.CChar32T
CHAR8PTR: t.CTypedef = t.CChar8T | t.CPtr
CHAR16PTR: t.CTypedef = t.CChar16T | t.CPtr
CHAR32PTR: t.CTypedef = t.CChar32T | t.CPtr
i8: t.CTypedef = t.CInt8T
i16: t.CTypedef = t.CInt16T
i32: t.CTypedef = t.CInt32T
i64: t.CTypedef = t.CInt64T
u8: t.CTypedef = t.CUInt8T
u16: t.CTypedef = t.CUInt16T
u32: t.CTypedef = t.CUInt32T
u64: t.CTypedef = t.CUInt64T
SIZE_T: t.CTypedef = t.CSizeT
SSIZE_T: t.CTypedef = t.CPtrDiffT
PTRDIFF_T: t.CTypedef = t.CPtrDiffT
int8_t: t.CTypedef = t.CInt8T
int16_t: t.CTypedef = t.CInt16T
int32_t: t.CTypedef = t.CInt32T
int64_t: t.CTypedef = t.CInt64T
uint8_t: t.CTypedef = t.CUInt8T
uint16_t: t.CTypedef = t.CUInt16T
uint32_t: t.CTypedef = t.CUInt32T
uint64_t: t.CTypedef = t.CUInt64T
size_t: t.CTypedef = t.CSizeT
ssize_t: t.CTypedef = t.CPtrDiffT
ptrdiff_t: t.CTypedef = t.CPtrDiffT
intptr_t: t.CTypedef = t.CIntPtrT
uintptr_t: t.CTypedef = t.CUIntPtrT
wchar_t: t.CTypedef = t.CWCharT
char8_t: t.CTypedef = t.CChar8T
char16_t: t.CTypedef = t.CChar16T
char32_t: t.CTypedef = t.CChar32T
float8_t: t.CTypedef = t.CFloat8T
float16_t: t.CTypedef = t.CFloat16T
float32_t: t.CTypedef = t.CFloat32T
float64_t: t.CTypedef = t.CFloat64T
float128_t: t.CTypedef = t.CFloat128T
_Bool: t.CTypedef = t.CBool