语法侧(M2.4):ast/base.vp 枚举尾部追加 ASTKind.New;ast/exprs.vp 新增 NEW_SRC_*/NEW_LIFE_* 与 class New;ast/parser.vp 新增 _is_new_expr/_parse_new_expr(new 为软关键字,不进 Keyword 表,new=1/new.x/new(1) 仍是标识符);ast/__init__.vp 再导出 New 与常量。 其余为既有 WIP 改动一并快照,保持基线一致(39 文件,+312/-237)。 未纳入:ctraits.vpi(已删除)、ctraits.vpnci、tomllib/(均未跟踪)。
39 lines
1019 B
Plaintext
39 lines
1019 B
Plaintext
define ATOMIC_RELAXED = 0
|
|
define ATOMIC_CONSUME = 1
|
|
define ATOMIC_ACQUIRE = 2
|
|
define ATOMIC_RELEASE = 3
|
|
define ATOMIC_ACQ_REL = 4
|
|
define ATOMIC_SEQ_CST = 5
|
|
|
|
|
|
def __atomic_test_and_set(ptr: uint64*, order: int) -> bool:
|
|
result: uint8 = 1
|
|
__asm__(f"""mov al, 1
|
|
xchg byte ptr [{asminp(ptr, ASM_DESCR.REG_ANY)}], al
|
|
mov $0, al""",
|
|
out = [asmout(result, ASM_DESCR.OUTPUT_REG)],
|
|
op = [ASM_DESCR.CLOBBER_MEMORY, ASM_DESCR.CLOBBER_RAX])
|
|
return bool(result)
|
|
|
|
|
|
def __atomic_clear(ptr: uint64*, order: int):
|
|
__asm__(f"""mov byte ptr [{asminp(ptr, ASM_DESCR.REG_ANY)}], 0""",
|
|
inp = [asminp(ptr, ASM_DESCR.REG_ANY)],
|
|
op = [ASM_DESCR.CLOBBER_MEMORY])
|
|
|
|
|
|
def __atomic_thread_fence(order: int):
|
|
__asm__("mfence", op=[ASM_DESCR.CLOBBER_MEMORY])
|
|
|
|
|
|
def __atomic_signal_fence(order: int):
|
|
pass
|
|
|
|
|
|
def __atomic_always_lock_free(size: sizet, ptr: rawptr) -> bool:
|
|
return True
|
|
|
|
|
|
def __atomic_is_lock_free(size: sizet, ptr: rawptr) -> bool:
|
|
return True
|