compileBlock bugfix: pyMod

This commit is contained in:
xushiwei
2024-05-13 00:41:42 +08:00
parent 46527f56ce
commit 31d5a8ac10
3 changed files with 15 additions and 13 deletions

View File

@@ -347,7 +347,8 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
if pyModInit = p.pyMod != ""; pyModInit { if pyModInit = p.pyMod != ""; pyModInit {
last = len(instrs) - 1 last = len(instrs) - 1
instrs = instrs[:last] instrs = instrs[:last]
} } else {
// TODO(xsw): confirm pyMod don't need to call LoadPyModSyms
p.inits = append(p.inits, func() { p.inits = append(p.inits, func() {
if objs := pkg.PyObjs(); len(objs) > 0 { if objs := pkg.PyObjs(); len(objs) > 0 {
mods := make(map[string][]llssa.PyObjRef) mods := make(map[string][]llssa.PyObjRef)
@@ -361,6 +362,7 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
} }
} }
}) })
}
} else if doMainInit { } else if doMainInit {
fn := p.fn fn := p.fn
argc := pkg.NewVar("__llgo_argc", types.NewPointer(types.Typ[types.Int32]), llssa.InC) argc := pkg.NewVar("__llgo_argc", types.NewPointer(types.Typ[types.Int32]), llssa.InC)

Binary file not shown.

Binary file not shown.