It took Android some time to even hit the 64K limit for regular method
calls, so switching to 16-bit IDs should be fine for method IDs of
interfaces. At least for the time being. When this limit is ever hit,
I'll think of another way, probably involving some platform-dependent
interface code (e.g. microcontrollers won't need 64K of methods) or
detecting the limit at build time.
https://android-developers.googleblog.com/2014/12/google-play-services-and-dex-method.html
Code size isn't changed, probably because the compiler optimizes away
all method calls.
This commit moves the itfmethod call implemented directly in LLVM IR to
a Go implementation in the runtime. Additionally, it fixes variable
names to be more obvious and adds a lot of documentation to explain how
interfaces actually work in TinyGo.
Code size changes for src/examples/hello:
nrf: -144
unix: -93
I'm guessing this code size reduction is a result of removing the
'noinline' function attribute.
Instead of mostly heuristics, actually execute the init() instruction in
an interpreter to calculate initializers for globals. This is far more
flexible and extensible, and gives the option of extending the
interpreter to other code and make it a partial evaluator.
This massively increases .data size, possibly because loads of unused
globals are included. I'll need to investigate what's going on here. For
now, increase the RAM size for nrf chips (the nrf52 has 64kB of RAM).
Missing features:
* keys other than strings
* more than 8 values in the hashmap
* growing a map when needed
* initial size hint
* delete(m, key)
* iterators (for range)
* initializing global maps
* ...more?
This reverts commit d9ca5f97fb.
There is a problem with coroutines that I haven't solved yet. Reverting
makes it work, for now.
Also, use a better coroutines flag for the LLVM opt tool.
This should make it much easier (in the future) to use the standard
library when unused functions contain unimplemented features. But more
importantly, it makes later passes better and makes compiling faster by
not having to scan dead code.