compiler: optimize struct copy a bit

POPITEM is cheaper than PUSH + PICKITEM.
This commit is contained in:
Evgeniy Stratonikov 2021-01-18 16:19:09 +03:00
parent 324107b31e
commit f0fe03117a

View file

@ -852,7 +852,7 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
// This way even non-pointer struct fields will be copied.
emit.Opcodes(c.prog.BinWriter, opcode.NEWARRAY0,
opcode.DUP, opcode.ROT, opcode.APPEND,
opcode.PUSH0, opcode.PICKITEM)
opcode.POPITEM)
}
}
// Do not swap for builtin functions.