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

14 коммитов

Автор SHA1 Сообщение Дата
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