compileBlock bugfix: pyMod
This commit is contained in:
@@ -347,20 +347,22 @@ 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() {
|
||||||
|
if objs := pkg.PyObjs(); len(objs) > 0 {
|
||||||
|
mods := make(map[string][]llssa.PyObjRef)
|
||||||
|
for name, obj := range objs {
|
||||||
|
modName := modOf(name)
|
||||||
|
mods[modName] = append(mods[modName], obj)
|
||||||
|
}
|
||||||
|
b.SetBlockEx(ret, llssa.AfterInit)
|
||||||
|
for modName, objs := range mods {
|
||||||
|
b.LoadPyModSyms(modName, objs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
p.inits = append(p.inits, func() {
|
|
||||||
if objs := pkg.PyObjs(); len(objs) > 0 {
|
|
||||||
mods := make(map[string][]llssa.PyObjRef)
|
|
||||||
for name, obj := range objs {
|
|
||||||
modName := modOf(name)
|
|
||||||
mods[modName] = append(mods[modName], obj)
|
|
||||||
}
|
|
||||||
b.SetBlockEx(ret, llssa.AfterInit)
|
|
||||||
for modName, objs := range mods {
|
|
||||||
b.LoadPyModSyms(modName, objs...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} 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.
Reference in New Issue
Block a user