import t, c from stdint import * import stdlib @t.CVTable class Coroutine: """协程帧句柄(M1:__ptr__ 持有 create_() 返回的帧指针)""" __ptr__: t.CPtr def coro_resume(c: Coroutine) -> t.CInt: # M1 占位:实际由编译器将 coro.coro_run 内联翻译为 resume_ 循环, # 本函数不会被真正调用(仅保证模块可编译)。 return 0 def coro_result(c: Coroutine) -> t.CInt: # M1 占位:coro_run 内联翻译直接从帧 ret 槽取结果。 return 0 def coro_run(c: Coroutine) -> t.CInt: # M1 占位实现:编译器在调用点对 coro.coro_run 做内联翻译(resume 循环)。 s: t.CInt = 0 while s == 0: s = coro_resume(c) return coro_result(c)