Only implements debugging with source lines and stacktraces (without
parameters), which already is a huge improvement over no debug
information at all. This should be extended to arguments and local
variables (of the correct DWARF type), but this is more work.
Comparing an interface to nil is easy, as the dynamic type is also nil.
Comparing the dynamic values (when the dynamic types match) is much
harder and depends on reflection capabilities, so is not yet implemented.
TODO: do better at it by tracking min/max values of integers. The
following straightforward code doesn't have its bounds checks removed:
for _, n := range slice {
println(n)
}
I've tried writing my own, but I couldn't make it correct in all cases.
So just copy the one from upstream for now, hopefully to be replaced at
some point.
TODO: add a printfloat32() implementation, now it just casts to float64.
This will be useful for embedded systems that sometimes have float32 but
not float64.
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.