asyncio: trap on unexpected resume

This commit is contained in:
Li Jie
2024-08-05 15:19:42 +08:00
parent a1fdc05e26
commit 3bf0780a67
6 changed files with 34 additions and 10 deletions

View File

@@ -232,11 +232,12 @@ func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function) (llssa.Fun
nBlkOff := 0
if nblk := len(f.Blocks); nblk > 0 {
if async {
nBlkOff = 4
nBlkOff = 5
fn.MakeBlock("entry")
fn.MakeBlock("alloc")
fn.MakeBlock("clean")
fn.MakeBlock("suspend")
fn.MakeBlock("trap")
}
fn.MakeBlocks(nblk) // to set fn.HasBody() = true
if f.Recover != nil { // set recover block