Граф коммитов

945 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
e2f6aedd9d
compiler: implement comparing structs directly 2018-10-23 13:27:18 +02:00
Ayke van Laethem
cbd7d401fe
testdata: go fmt 2018-10-23 13:24:18 +02:00
Ayke van Laethem
82be43f4e6
compiler: implement deferring of immediately-applied closures
This is a common operation:

    freevar := ...
    defer func() {
        println("I am deferred:", freevar)
    }()

The function is thus an immediately applied closure. Only this form is
currently supported, support for regular (fat) function pointers should
be trivial to add but is not currently implemented as it wasn't
necessary to get fmt to compile.
2018-10-22 14:06:51 +02:00
Ayke van Laethem
9b9b66a09d
compiler: add complex manipulation
* builtins: real, imag, complex
* printing of complex numbers

No support for complex arithmetic yet.
2018-10-22 13:49:03 +02:00
Ayke van Laethem
9393cdd5ed
README: add WebAssembly as a supported target 2018-10-22 12:40:06 +02:00
Ayke van Laethem
c88d2d10a7
docs: give a working Docker example 2018-10-21 22:42:38 +02:00
Ayke van Laethem
58ce5d9bf2
docs: add WebAssembly to targets and improve formatting 2018-10-21 20:22:21 +02:00
Ayke van Laethem
e5e09747f0
all: add WebAssembly backend 2018-10-21 19:47:47 +02:00
Johan Brandhorst
a51e04c550
Dockerfile: include necessary build subfolders
When building, tinygo needs access to files relative to
the directory it was built from. Include src and targets
directories.
2018-10-21 17:52:12 +01:00
Johan Brandhorst
f1b3ec4be8 Dockerfile: add vendor step
The Dockerfile was missing the part where we download
the dependencies into the vendor folder. It was of course
working locally because I had a vendor folder already.
2018-10-21 16:21:04 +01:00
Ayke van Laethem
dda9c1cc6e
ir: fix interface call edge case
A function on a type that is put in an interface must not be assumed to
not need a context pointer when it isn't directly put in a function
pointer, because the interface call side won't know this and pass an
extra parameter with that extra function pointer.

This is usually not a problem but WebAssembly has strict checks on
function signatures so this resulted in an error when running
src/examples/test/test.go.
2018-10-21 01:33:40 +02:00
Johan Brandhorst
97caabb8c2 Add Dockerfile 2018-10-21 00:28:18 +01:00
Johan Brandhorst
3d644e6ea8 Add dep files 2018-10-20 23:29:32 +01:00
Ayke van Laethem
ad06ed46cd
runtime: fix linker error: os.sigpipe 2018-10-20 18:37:58 +02:00
Ayke van Laethem
0a06c6014d
compiler: special slice bounds check for 64-bit numbers
It is allowed to index with an int64 even on a 32-bit platform, so we
have to handle that case. But make sure the normal case isn't penalized
by using 32-bit numbers when possible.
2018-10-20 18:28:00 +02:00
Ayke van Laethem
239504d9f4
compiler: implement recover()
Doesn't do anything useful yet as running deferred calls are not
executed during panic. Only implemented to get code to compile.
2018-10-20 18:00:12 +02:00
Ayke van Laethem
7c2a6169b0
compiler: support comma-ok in map lookup 2018-10-20 17:54:16 +02:00
Ayke van Laethem
da89464a63
compiler: compare slice against nil 2018-10-20 17:22:51 +02:00
Ayke van Laethem
3f05490846
compiler: fix odd bounds check failure with impossible typeassert 2018-10-20 17:21:47 +02:00
Ayke van Laethem
77d6d6c417
compiler: allow structs in map keys 2018-10-20 17:21:13 +02:00
Ayke van Laethem
c0c1ccb381
compiler, runtime: implement delete builtin 2018-10-20 16:18:55 +02:00
Ayke van Laethem
7f60dd79ee
sync: implement dummy sync.Pool for fmt 2018-10-20 15:52:41 +02:00
Ayke van Laethem
19f7927515
compiler: compare booleans
Implement == and != for booleans.
2018-10-20 15:47:59 +02:00
Ayke van Laethem
6a95b84cd8
compiler: support all operations on untyped strings
Operations on strings were not always also supported on untyped strings.
Make sure all of those operations are supported for both.
2018-10-20 15:47:02 +02:00
Ayke van Laethem
22bc0f979d
README: scope 2018-10-20 15:20:11 +02:00
Ayke van Laethem
c4557176ef
README: contributing 2018-10-20 14:50:44 +02:00
Ayke van Laethem
55a60acbf4
README: improve documentation references 2018-10-20 14:35:04 +02:00
Ayke van Laethem
3babdfdc00
compiler: fix runtime.mainWrapper linkage and debug info 2018-10-19 17:39:41 +02:00
Ayke van Laethem
963ba16d7b
compiler: add support for the append builtin 2018-10-19 14:40:19 +02:00
Ayke van Laethem
b81aecf753
docs: add "Supported targets" page 2018-10-18 15:35:50 +02:00
Ayke van Laethem
fd45410c24
runtime: add proper arm arch 2018-10-18 15:23:52 +02:00
Ayke van Laethem
daf92226d8
nrf: add nrf52840-mdk board
With the help of Chillance on GitHub.
2018-10-18 15:07:06 +02:00
Ayke van Laethem
f9edf7cc5c
test: add slice tests 2018-10-18 15:02:53 +02:00
Ayke van Laethem
72390c21cb
docs: add FAQ 2018-10-17 17:55:11 +02:00
Ayke van Laethem
a613d0484e
runtime: add support for time.Now()
TODO: On unix systems, this does not return an accurate value.
2018-10-15 20:20:37 +02:00
Ayke van Laethem
ccee42ec7a
machine: add helpers for bit-banged driver support
The returned pointer and value can be used to set or clear a specific
pin.
2018-10-15 19:56:27 +02:00
Ayke van Laethem
392bba8394
compiler: add support for parameters to inline assembly 2018-10-15 19:37:09 +02:00
Ayke van Laethem
52199f4a14
compiler: eliminate created but never used maps 2018-10-12 17:00:39 +02:00
Ayke van Laethem
25e73a5439
compiler: align and zero-initialize stack allocated values 2018-10-12 16:57:17 +02:00
Ayke van Laethem
2917347ff5
compiler: implement operations on some named types 2018-10-12 16:53:55 +02:00
Ayke van Laethem
9406a4d74a
main: add -opt= flag for the optimization level 2018-10-10 14:14:45 +02:00
Ayke van Laethem
0ed00bf6c6
test: add hashmap tests
Hashmaps are still very primitive. These tests check that there are at
least no regressions in hashmap support.
2018-10-10 14:11:15 +02:00
Ayke van Laethem
0ce5347409
runtime: fix hashmap lookup of entries at position > 8
Bigger hashmaps (size > 8) use multiple buckets in a chain. The lookup
code looked at multiple buckets for a lookup, but kept checking the
first bucket for key equality.
2018-10-10 14:09:17 +02:00
Ayke van Laethem
e1e3dbdce6
compiler: correctly generate global hashmaps of size > 8
Static map generation used the last bucket instead of the first bucket
in the chain, which caused lots of missing entries in hashmaps with
multiple buckets (size > 8).
2018-10-10 14:06:59 +02:00
Ayke van Laethem
0e65b0da1c
docs: add page "Go on microcontrollers" 2018-10-09 15:32:40 +02:00
Ayke van Laethem
823ecd5167
docs: reorder internals sections 2018-10-09 15:32:40 +02:00
Ayke van Laethem
ec73bd6a26
compiler: optimize runtime.stringToBytes calls
This optimization makes sure the following pattern doesn't do a heap
allocation (assuming Write doesn't modify the slice):

    var w *machine.UART = ...
    w.Write([]byte("foo"))

As long as Write doesn't modify the slice and LLVM can detect this, a
call to runtime.stringToBytes with the necessary allocation + copy is
avoided.
2018-10-09 14:18:12 +02:00
Ayke van Laethem
4219652535
compiler: add basic heap-to-stack optimization 2018-10-09 14:14:52 +02:00
Ron Evans
ca13bfd992
microbit: add SetEntireLEDMatrixOn() function
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-08 20:38:21 +02:00
Ayke van Laethem
aee9eb413e
main, travis: add qemu to run tests in
This makes sure we'll catch bugs that occur only on ARM hardware.
2018-10-08 20:36:25 +02:00