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
@@ -286,6 +286,10 @@ class ExprCallHandle(BaseHandle):
if isinstance(Node.func, ast.Attribute) and Node.func.attr == 'coro_exception':
if isinstance(Node.func.value, ast.Name) and self.Trans.AsyncHandler._IsCoroModule(Node.func.value.id):
return self.Trans.AsyncHandler._HandleCoroExceptionLlvm(Node, Gen)
# 协程:coro.coro_exception_msg(帧) 内联翻译为帧 msg 槽读取
if isinstance(Node.func, ast.Attribute) and Node.func.attr == 'coro_exception_msg':
if isinstance(Node.func.value, ast.Name) and self.Trans.AsyncHandler._IsCoroModule(Node.func.value.id):
return self.Trans.AsyncHandler._HandleCoroExceptionMsgLlvm(Node, Gen)
# 协程:coro.coro_gather(帧...) 内联翻译为并发推进循环
if isinstance(Node.func, ast.Attribute) and Node.func.attr == 'coro_gather':
if isinstance(Node.func.value, ast.Name) and self.Trans.AsyncHandler._IsCoroModule(Node.func.value.id):