Merge commit 'd06146ed970f52d564521ff0be7d56839c85e497' into async-functions

* commit 'd06146ed970f52d564521ff0be7d56839c85e497': (152 commits)
  perf(lib/sync): avoid using `defer`
  refactor(c-libuv): Added TODO(uid) comment & adjusted the position of Handle, Stream, Req, Write, Connect
  README: io/ioutil
  library: io/ioutil
  c/openssl: bio, pem, rsa
  refactor(c/libuv): Adapt libuv.Fs struct
  Revert "fix(c/libuv): Add libuv fs struct new func"
  fix(c/libuv): Fix async_fs demo return 255 error & pointer not allocated error
  fix(c/libuv): Add libuv fs struct new func
  doc/c:refine symbol visibility description
  README: math/big
  library: math/big.Int (mini-impl for _cmptest/bigintdemo)
  doc/c:update implicit destructors description
  c/openssl: bignum, rsa
  library: crypto
  library: crypto/{sha1, sha256, sha512}
  doc/c:fix incorrect usage in construtors
  doc/c:update destructor usage
  delete sum
  fix test error
  ...

# Conflicts:
#	ssa/eh.go
This commit is contained in:
Li Jie
2024-08-04 10:26:27 +08:00
165 changed files with 11563 additions and 606 deletions

View File

@@ -195,6 +195,9 @@ func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function) (llssa.Fun
isInit := (f.Name() == "init" && sig.Recv() == nil)
if isInit && state == pkgHasPatch {
name = initFnNameOfHasPatch(name)
// TODO(xsw): pkg.init$guard has been set, change ssa.If to ssa.Jump
block := f.Blocks[0].Instrs[1].(*ssa.If).Block()
block.Succs[0], block.Succs[1] = block.Succs[1], block.Succs[0]
}
fn := pkg.FuncOf(name)
@@ -298,7 +301,7 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
if pyModInit = p.pyMod != ""; pyModInit {
last = len(instrs) - 1
instrs = instrs[:last]
} else {
} else if p.state != pkgHasPatch {
// TODO(xsw): confirm pyMod don't need to call AfterInit
p.inits = append(p.inits, func() {
pkg.AfterInit(b, ret)
@@ -315,7 +318,7 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
b.Call(pkg.FuncOf("main.init").Expr)
}
for i, instr := range instrs {
if i == 1 && doModInit && p.state == pkgInPatch {
if i == 1 && doModInit && p.state == pkgInPatch { // in patch package but no pkgFNoOldInit
initFnNameOld := initFnNameOfHasPatch(p.fn.Name())
fnOld := pkg.NewFunc(initFnNameOld, llssa.NoArgsNoRet, llssa.InC)
b.Call(fnOld.Expr)