mirror of https://github.com/tinygo-org/tinygo.git
Browse Source
By running these interprocedural optimizations after interface lowering, in particular the heap-to-stack transformation pass, interfaces can be zero cost in some more cases. For example, say you have the following interface: type Writer interface { Write([]byte) (int, error) } and you do something with it: func foo(w io.Writer) { w.Write([]byte("foo")) } this commit enables escape analysis across interface boundaries, which means that the Write call does not cause an allocation if all implementations of io.Writer do not let the slice escape. This enables broader uses of interfaces, as they are now a zero-cost abstraction in more cases.pull/109/head
Ayke van Laethem
6 years ago
1 changed files with 9 additions and 0 deletions
Loading…
Reference in new issue