goroutine support; llgo/ssa: memory (malloc/free)

This commit is contained in:
xushiwei
2024-06-01 15:52:54 +08:00
parent 33ba94e784
commit e5802853c0
7 changed files with 535 additions and 319 deletions

View File

@@ -163,6 +163,12 @@ type aProgram struct {
loadPyModS *types.Signature
getAttrStr *types.Signature
mallocTy *types.Signature
freeTy *types.Signature
createThdTy *types.Signature
routineTy *types.Signature
paramObjPtr_ *types.Var
ptrSize int
@@ -511,6 +517,8 @@ func (p Program) Uint64() Type {
// and unspecified other things too.
type aPackage struct {
mod llvm.Module
abi abi.Builder
abiTypes
vars map[string]Global
fns map[string]Function
@@ -519,8 +527,7 @@ type aPackage struct {
pymods map[string]Global
Prog Program
abi abi.Builder
abiTypes
iRoutine int
}
type Package = *aPackage
@@ -532,6 +539,10 @@ func (p Package) rtFunc(fnName string) Expr {
return p.NewFunc(name, sig, InGo).Expr
}
func (p Package) cFunc(fullName string, sig *types.Signature) Expr {
return p.NewFunc(fullName, sig, InC).Expr
}
func (p Package) pyFunc(fullName string, sig *types.Signature) Expr {
p.Prog.NeedPyInit = true
return p.NewFunc(fullName, sig, InC).Expr