tinygo/testdata
Ayke van Laethem b4c90f3677
compiler: lower interfaces in a separate pass
This commit changes many things:

  * Most interface-related operations are moved into an optimization
    pass for more modularity. IR construction creates pseudo-calls which
    are lowered in this pass.
  * Type codes are assigned in this interface lowering pass, after DCE.
  * Type codes are sorted by usage: types more often used in type
    asserts are assigned lower numbers to ease jump table construction
    during machine code generation.
  * Interface assertions are optimized: they are replaced by constant
    false, comparison against a constant, or a typeswitch with only
    concrete types in the general case.
  * Interface calls are replaced with unreachable, direct calls, or a
    concrete type switch with direct calls depending on the number of
    implementing types. This hopefully makes some interface patterns
    zero-cost.

These changes lead to a ~0.5K reduction in code size on Cortex-M for
testdata/interface.go. It appears that a major cause for this is the
replacement of function pointers with direct calls, which are far more
susceptible to optimization. Also, not having a fixed global array of
function pointers greatly helps dead code elimination.

This change also makes future optimizations easier, like optimizations
on interface value comparisons.
2018-12-01 13:26:06 +01:00
..
binop.go compiler: fix binops on named types in struct fields 2018-11-24 22:13:01 +01:00
binop.txt compiler: implement array equality 2018-11-15 11:51:16 +01:00
calls.go compiler: implement deferring of interface calls 2018-11-03 20:21:43 +01:00
calls.txt compiler: implement deferring of interface calls 2018-11-03 20:21:43 +01:00
coroutines.go main: add coroutine/sleep tests 2018-09-29 00:11:58 +02:00
coroutines.txt main: add coroutine/sleep tests 2018-09-29 00:11:58 +02:00
float.go compiler: fix float <-> int conversions 2018-11-03 12:20:55 +01:00
float.txt compiler: fix float <-> int conversions 2018-11-03 12:20:55 +01:00
gc.go runtime: implement a simple mark/sweep garbage collector 2018-11-18 19:18:39 +01:00
gc.txt runtime: implement a simple mark/sweep garbage collector 2018-11-18 19:18:39 +01:00
init.go interp: add new compile-time package initialization interpreter 2018-11-04 18:40:51 +01:00
init.txt interp: add new compile-time package initialization interpreter 2018-11-04 18:40:51 +01:00
init_multi.go testdata: add more test cases in testdata 2018-10-25 20:37:35 +02:00
init_multi.txt testdata: add more test cases in testdata 2018-10-25 20:37:35 +02:00
interface.go compiler: lower interfaces in a separate pass 2018-12-01 13:26:06 +01:00
interface.txt compiler: fix invalid incoming block in complex typeassert flow 2018-10-23 15:00:37 +02:00
map.go compiler: implement operations on nil hashmaps 2018-10-27 00:57:37 +02:00
map.txt compiler: implement operations on nil hashmaps 2018-10-27 00:57:37 +02:00
print.go testdata: go fmt 2018-10-23 13:24:18 +02:00
print.txt compiler: add complex manipulation 2018-10-22 13:49:03 +02:00
slice.go compiler: support creating slices with uncommon initial len/cap types 2018-11-18 18:35:29 +01:00
slice.txt compiler: compare slice against nil 2018-10-20 17:22:51 +02:00
structexpand.go testdata: add better tests for struct expanding 2018-09-25 14:24:44 +02:00
structexpand.txt testdata: add better tests for struct expanding 2018-09-25 14:24:44 +02:00