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

476 коммитов

Автор SHA1 Сообщение Дата
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
Ayke van Laethem
3289dd7134
compiler: use a fresh context for every compilation 2018-10-08 20:18:12 +02:00
Ayke van Laethem
a63af97e86
all: add emulation support for Cortex-M3 with QEMU 2018-10-08 17:07:19 +02:00
Ayke van Laethem
8982b8df83
runtime: refactor initialization code
Let each target handle its own initialization/finalization sequence
instead of providing one in the runtime with hooks for memory
initialization etc. This is much more flexible although it causes a
little bit of code duplication.
2018-10-08 14:49:33 +02:00
Ayke van Laethem
96f07243a4
main: add aeabi builtins to arm targets
Some builtins require these __aeabi_* functions.
2018-10-07 23:20:46 +02:00
Ayke van Laethem
e50c6f1af1
main: generate binary files when compiling to .bin 2018-10-07 22:48:33 +02:00
Ayke van Laethem
f0f6a12d19
docs: add avr-libc as a dependency 2018-10-07 22:14:44 +02:00
Ayke van Laethem
1bbdab41d2
all: improve compiler-rt compilation
A few changes to make sure compiler-rt is correctly compiled (and
doesn't include host headers, for example).

This improves support for AVR, but it still doesn't work. Compiler-rt
itself doesn't really work for AVR either.
2018-10-07 21:29:45 +02:00
Ayke van Laethem
73709922b2
main: extra interface test for simple named types 2018-10-07 19:40:21 +02:00
Ron Evans
c516a11004
microbit: add functions for LED matrix and correct button pin mapping
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-07 19:40:16 +02:00
Ron Evans
269bef5494
microbit: add Makefile entries for target=microbit
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-07 19:06:00 +02:00
Ayke van Laethem
22da104530
all: use compiler-rt for builtins 2018-10-07 19:04:29 +02:00
Ayke van Laethem
e8f211935e
compiler: fix expanded structs in invoke calls 2018-10-07 13:19:38 +02:00
Ayke van Laethem
4957db89f4
compiler: fix interface calls for big underlying values
When the underlying value of an interface does not fit in a pointer, a
pointer to the value was correctly inserted in the heap. However, the
receiving method still assumed it got the underlying value instead of a
pointer to it leading to a crash.

This commit inserts wrapper functions for method calls on interfaces.

The bug wasn't obvious as on a 64-bit system, the underlying value was
almost always put directly in the interface. However, it led to a crash
on the AVR platform where pointer are (usually) just 16 bits making it
far more likely that underlying values cannot be directly stored in an
interface.
2018-10-07 02:06:48 +02:00
Ayke van Laethem
482c5633dd
compiler: put debug information on package initializer functions
Make sure package initializers show up in backtraces, as they should. In
practice, it doesn't actually break backtraces as these functions are
usually inlined anyway, but it may help to debug an error in
initialization code.
2018-10-06 23:50:35 +02:00
Ayke van Laethem
5db43e8d04
compiler: move Optimize() function to a separate file
In the future, there will be more optimizations. Let's keep them in a
separate file for separation of concerns.
2018-10-06 19:57:41 +02:00
Ayke van Laethem
c9c9935b9c
travis: add micro:bit 2018-10-06 13:51:40 +02:00
Ayke van Laethem
bc9210b674
nrf: add micro:bit board 2018-10-06 13:04:14 +02:00
Ron Evans
e4fa1a8288
nrf: I2C interface
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-05 12:50:43 +02:00
Ron Evans
8f7b7e6ee3
nrf52: implement ADC and PWM interfaces
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2018-10-04 13:56:44 +02:00