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

18 коммитов

Автор SHA1 Сообщение Дата
Jaden Weiss
d843ebfe40 Improved blocking (#513)
core: major improvements to blocking, including support for buffered channels.
2019-09-22 17:58:00 +02:00
Ayke van Laethem
10ed3decb0 compiler: rename getZeroValue to llvm.ConstNull
It does the same thing but should be more complete, and it probably is
faster as well (just one CGo call instead of several).
2019-09-15 19:09:10 +02:00
Justin Clift
46872a70b1 Trivial typo fix 2019-06-20 13:30:38 +02:00
Ayke van Laethem
371c468e8e compiler: add debug info for function arguments
This commit adds debug info to function arguments, so that in many cases
you can see them when compiling with less optimizations enabled.
Unfortunately, due to the way Go SSA works, it is hard to preserve them
in many cases.
Local variables are not yet saved.

Also, change the language type to C, to make sure lldb shows function
arguments. The previous language was Modula 3, apparently due to a
off-by-one error somewhere.
2019-05-14 11:18:38 +02:00
Ayke van Laethem
6d23809218 compiler: simplify code around getZeroValue
The LLVM library we use does not (yet) provide a llvm.Zero (like it
provides a llvm.Undef) so we have implemented our own. However, in
theory it might return an error in some cases.

No real-world errors have been seen in a while and errors would likely
indicate a serious compiler bug anyway (not an external error), so make
it panic instead of returning an error.
2019-04-26 08:52:10 +02:00
Ayke van Laethem
1db9a162da
all: go fmt
The import path changes changed the order of imports, but no `go fmt`
was run before the commit. Oops...
2019-01-31 16:22:05 +01:00
Ayke van Laethem
9092dbcc53
all: rename go-llvm to new import path
the new import path is:

    tinygo.org/x/go-llvm
2019-01-27 19:26:16 +01:00
Ayke van Laethem
602c264749
all: rewrite goroutine lowering
Before this commit, goroutine support was spread through the compiler.
This commit changes this support, so that the compiler itself only
generates simple intrinsics and leaves the real support to a compiler
pass that runs as one of the TinyGo-specific optimization passes.

The biggest change, that was done together with the rewrite, was support
for goroutines in WebAssembly for JavaScript. The challenge in
JavaScript is that in general no blocking operations are allowed, which
means that programs that call time.Sleep() but do not start goroutines
also have to be scheduled by the scheduler.
2019-01-21 22:09:33 +01:00
Ron Evans
b4dd2dbf60
docs: change links in README and remove old ReadTheDocs pages to point to TinyGo.org site
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-01-13 20:29:45 +01:00
Ayke van Laethem
564b1b3312
compiler: always use fat function pointers with context
This reduces complexity in the compiler without affecting binary sizes
too much.

Cortex-M0:   no changes
Linux x64:   no changes
WebAssembly: some testcases (calls, coroutines, map) are slightly bigger
2018-12-09 18:47:39 +01:00
Ayke van Laethem
d7844ce124
compiler, runtime: move defer notes to the runtime file
This seems like the more appropriate place to describe the
implementation of defer.
2018-11-01 11:42:04 +01:00
Ayke van Laethem
c7cf6f0e82
docs: move calling convention documentation here 2018-11-01 11:41:24 +01: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
3289dd7134
compiler: use a fresh context for every compilation 2018-10-08 20:18:12 +02:00
Ayke van Laethem
f107a24b72
all: use LLVM library provided by the system 2018-09-30 15:10:04 +02:00
Ayke van Laethem
174b6333f8
compiler: fix expanding zero-length structs 2018-09-25 13:45:04 +02:00
Ayke van Laethem
7cea40bcb5
compiler: small cleanup in call handling code 2018-09-23 03:01:10 +02:00
Ayke van Laethem
fdfa810060
compiler: expand small structs
Use fields of small structs (3 or less fields when flattened
recursively) directly as parameter values.

Advantages:
  * Code size is slightly reduced, both on unix and nrf.
  * AVR can finally deal with struct parameters - at least the small
    ones. examples/test now compiles. A real fix for struct parameters
    should go into upstream LLVM, but this is a nice win.

fixes #20
2018-09-23 02:39:05 +02:00