修复了大量存在的问题,增加了假鸭子类型等等机制
This commit is contained in:
@@ -9,7 +9,7 @@ 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 | t.State:
|
||||
def __atomic_test_and_set(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CBool:
|
||||
result: t.CUInt8T = 1
|
||||
c.Asm(f"""mov al, 1
|
||||
xchg byte ptr [{c.AsmInp(ptr, t.ASM_DESCR.REG_ANY)}], al
|
||||
@@ -20,23 +20,23 @@ def __atomic_test_and_set(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CBool |
|
||||
return t.CBool(result)
|
||||
|
||||
|
||||
def __atomic_clear(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CVoid | t.State:
|
||||
def __atomic_clear(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CVoid:
|
||||
c.Asm(f"""mov byte ptr [{c.AsmInp(ptr, t.ASM_DESCR.REG_ANY)}], 0""",
|
||||
inp = [c.AsmInp(ptr, t.ASM_DESCR.REG_ANY)],
|
||||
op = [t.ASM_DESCR.CLOBBER_MEMORY])
|
||||
|
||||
|
||||
def __atomic_thread_fence(order: t.CInt) -> t.CVoid | t.State:
|
||||
def __atomic_thread_fence(order: t.CInt) -> t.CVoid:
|
||||
c.Asm("mfence", op=[t.ASM_DESCR.CLOBBER_MEMORY])
|
||||
|
||||
|
||||
def __atomic_signal_fence(order: t.CInt) -> t.CVoid | t.State:
|
||||
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 | t.State:
|
||||
def __atomic_always_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool:
|
||||
return t.CBool(1)
|
||||
|
||||
|
||||
def __atomic_is_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool | t.State:
|
||||
def __atomic_is_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool:
|
||||
return t.CBool(1)
|
||||
|
||||
Reference in New Issue
Block a user