feat(coro): M7——try/finally、异常消息、自定义异常类、帧池复用

- try/finally(无 except):正常/异常路径都执行 fbody,异常时 finally 后
  重新传播(done+br exit);finally 内暂不支持 await
- 异常消息:帧加 msg 槽(i8*,index 4),raise X(msg) 存消息,await 传播,
  coro_exception_msg 查询
- raise 支持自定义异常类(exception_registry 码),多 except 匹配子类码
- 帧池复用:per-type free-list 全局池,create 弹池/空则 malloc,coro_destroy
  回池(帧头部存 next),避免反复 malloc/free
- 修复 ast.walk 传 list 崩溃(finalbody/For body)
- CoroTest 验证:finally 执行、MyError exc=100 msg=boom msg、3 次循环池复用
This commit is contained in:
TermiNexus committed 2026-08-21 14:46:21 +08:00
1 parent 8b9e88287a
commit 8ce08493e8
4 files changed
+191 -40

No files matched your search

+4
View File
@@ -44,3 +44,7 @@ def coro_exception(c: Coroutine) -> t.CInt:
def coro_gather(a: Coroutine) -> t.CInt:
# M4 占位:编译器将 coro.coro_gather(帧...) 内联翻译为并发推进循环。
return 0
def coro_exception_msg(c: Coroutine) -> t.CPtr:
# M7 占位:编译器将 coro.coro_exception_msg(帧) 内联翻译为帧 msg 槽读取。
return null