runtime: map; llgo/ssa: MapUpdate

This commit is contained in:
xushiwei
2024-06-14 21:57:34 +08:00
parent 7a54967bee
commit 47b20b01d0
12 changed files with 491 additions and 46 deletions

View File

@@ -360,8 +360,13 @@ func (b Builder) MapUpdate(m, k, v Expr) {
if debugInstr {
log.Printf("MapUpdate %v[%v] = %v\n", m.impl, k.impl, v.impl)
}
// TODO(xsw)
// panic("todo")
t := m.Type
if t.kind != vkMap {
panic("TODO: not a map")
}
tabi := b.abiType(t.raw.Type)
ptr := b.InlineCall(b.Pkg.rtFunc("MapAssign"), tabi, m, k)
b.Store(ptr, v) // TODO(xsw): indirect store
}
// -----------------------------------------------------------------------------