ssa: set pointer directiface

This commit is contained in:
visualfc
2024-07-03 22:16:24 +08:00
parent 490a16a8df
commit bcb217c1da
19 changed files with 1098 additions and 386 deletions

View File

@@ -361,7 +361,7 @@ func (p Package) abiTypeInit(g Global, t types.Type, pub bool) {
}
vexpr := tabi()
prog := p.Prog
kind, _, lvl := abi.DataKindOf(t, 0, prog.is32Bits)
kind, _, _ := abi.DataKindOf(t, 0, prog.is32Bits)
switch kind {
case abi.Integer, abi.BitCast:
// abi.Type.Kind_ |= abi.KindDirectIface
@@ -369,9 +369,7 @@ func (p Package) abiTypeInit(g Global, t types.Type, pub bool) {
pkind := b.FieldAddr(vexpr, 6)
b.Store(pkind, b.BinOp(token.OR, b.Load(pkind), Expr{prog.IntVal(kindDirectIface, prog.Byte()).impl, prog.Byte()}))
case abi.Pointer:
if lvl > 0 {
b.InlineCall(b.Pkg.rtFunc("SetDirectIface"), vexpr)
}
b.InlineCall(b.Pkg.rtFunc("SetDirectIface"), vexpr)
}
b.Store(expr, vexpr)
if pub {

View File

@@ -550,7 +550,7 @@ func (b Builder) BinOp(op token.Token, x, y Expr) Expr {
x = b.Field(x, 0)
y = b.Field(y, 0)
fallthrough
case vkFuncPtr, vkFuncDecl:
case vkFuncPtr, vkFuncDecl, vkChan:
switch op {
case token.EQL:
return Expr{llvm.CreateICmp(b.impl, llvm.IntEQ, x.impl, y.impl), tret}