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

833 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
714d98354c arm: provide intrinsics to disable/enable interrupts 2019-02-23 18:52:49 +01:00
Ayke van Laethem
6e8df2fc40 samd21: define and use hardware pin numbers 2019-02-23 16:20:56 +01:00
Ayke van Laethem
902f40867f samd21: add GPIO support for port B 2019-02-23 13:53:59 +01:00
Ron Evans
5438f16fcb
machine/atsamd21: support for USB CDC aka serial interface
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-23 13:34:00 +01:00
Ron Evans
7f027ddd33 machine/samd21: correct calculation for runtime ticks() function so that go routine scheduling can function as expected as described in issue #149
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-23 13:22:24 +01:00
Ron Evans
acaf096586 compiler: extend flash command to support different output file types, based on contents of flash key in target file
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-23 11:31:38 +01:00
Ron Evans
942d4903ce
machine/atsamd21: extracts functionality for processor family into shared files.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-20 14:16:09 +01:00
Ayke van Laethem
0b212cf2f6 all: add macOS support 2019-02-19 15:54:36 +01:00
Ron Evans
2d5bc836f5 build: correct Makefile to build tinygo executable correctly when build directory does not exist, such as after running 'make clean'
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-19 12:28:50 +01:00
Ayke van Laethem
856e5fa179 ir: remove old cgo related code
There is now a custom implementation of CGo based on libclang.
2019-02-19 09:08:13 +01:00
Ayke van Laethem
07733ca056 compiler: remove some dead code reported by go vet 2019-02-19 09:08:13 +01:00
Ayke van Laethem
92d9b780b5 all: remove init interpretation during IR construction
The interp package does a much better job at interpretation, and is
implemented as a pass on the IR which makes it much easier to compose.
Also, the implementation works much better as it is based on LLVM IR
instead of Go SSA.
2019-02-19 09:08:13 +01:00
Ayke van Laethem
da345e8723 cgo: implement bool/float/complex types 2019-02-18 17:17:56 +01:00
Ayke van Laethem
fab38a0749 compiler: use Clang data layout for complex numbers
Match data layout of complex numbers to that of Clang, for better
interoperability. This makes alignment of complex numbes the same as the
individual elements (real and imaginary), as is required by the C spec
and implemented in Clang, but unlike the gc compler. The Go language
specification is silent on this matter.

> Each complex type has the same object representation and alignment
> requirements as an array of two elements of the corresponding real
> type (float for float complex, double for double complex, long double
> for long double complex). The first element of the array holds the
> real part, and the second element of the array holds the imaginary
> component.

Source: https://en.cppreference.com/w/c/language/arithmetic_types
2019-02-18 17:17:56 +01:00
Daniel Esteban
0a3dbbd1cb Added regular pins const for bbc:microbit (#181)
* Added "GPIO/Analog" pins const for bbc:microbit
2019-02-11 16:33:10 +01:00
admin
4c29f0fdb6
wasm: support wasm example on Safari 2019-02-11 14:20:20 +01:00
Ayke van Laethem
fbc2099ee3
main: version v0.2.0 2019-02-08 16:54:50 +01:00
Ayke van Laethem
95d895646a
loader/cgo: add support for function pointers 2019-02-08 13:19:02 +01:00
Ayke van Laethem
35fb594f8f
loader/cgo: add support for pointer types 2019-02-08 13:19:02 +01:00
Ayke
01f6aff422 loader: support global variables in CGo (#173)
Global variables (like functions) must be declared in the import "C" preamble and can then be used from Go.
2019-02-08 13:04:03 +01:00
Ron Evans
7dd5839f47
build: display output file sizes for target smoke test builds on Travis (#175)
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-08 13:03:20 +01:00
Ron Evans
403fee7e06
Add tinygo version subcommand (#172)
* cmd: add tinygo version subcommand to display current software version. Also displayed when usage is displayed
2019-02-08 11:22:47 +01:00
Ron Evans
7657238c24
docs: refactor README content (#171)
* docs: refactor README to avoid duplication with information on the web site, and to reorder to make it easier for new users.
2019-02-08 08:59:06 +01:00
Ayke van Laethem
3cba36f2ba compiler: add syscalls for 64-bit arm 2019-02-07 07:00:37 +01:00
Ayke van Laethem
93d5269fef compiler: add syscalls for 32-bit arm 2019-02-07 07:00:37 +01:00
Ayke van Laethem
4b477fad55 all: update Travis CI to Ubuntu Xenial
This lets us test with a more recent base, and should fix various
issues.
2019-02-05 19:39:33 +01:00
Ayke van Laethem
6360e318a7 runtime: add support for math package
The math package uses routines written in Go assembly language which
LLVM/Clang cannot parse. Additionally, not all instruction sets are
supported.

Redirect all math functions written in assembly to their Go equivalent.
This is not the fastest option, but it gets packages requiring math
functions to work.
2019-02-05 19:37:21 +01:00
Ayke van Laethem
0757eb5919 main: link with --gc-sections
This may help reduce code size in some cases.
2019-02-05 19:37:21 +01:00
Ayke van Laethem
013a71aa3d compiler: support NaN in float comparisons
LLVM supports both "ordered" and "unordered" floating point comparisons.
The difference is that unordered comparisons ignore NaN and produce
incorrect results when presented with a NaN value.
This commit switches these comparisons from ordered to unordered.
2019-02-05 19:37:21 +01:00
Ron Evans
f0091b31b5
Add CONTRIBUTING.md to help us help you (#169)
* docs: add contributing guidelines to make it easier to help the project

Signed-off-by: Ron Evans <ron@hybridgroup.com>

* docs: add info about Slack channel to contributing guidelines

Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-05 18:25:19 +01:00
Ayke van Laethem
709a296150 os: add basic OS functionality 2019-02-05 17:37:55 +01:00
Ayke van Laethem
f7b2a2c977 compiler: implement syscall.Syscall* as builtins
Treating them as builtins is easier to implement and likely reduces code
size.
2019-02-05 17:37:55 +01:00
Ayke van Laethem
6ae4b43eb2 interp: fix recursive scanning
There were a few issues that made interp not perform as it should:

  * The scan was non-recursive due to a bug.
  * Recursive scanning would always return the severity level, which is
    not always the best strategy.
2019-02-05 17:37:55 +01:00
Ayke van Laethem
bece6b9648 interp: remove init call when hitting 'unreachable'
The interp package interprets calls in runtime.initAll and replaces
these calls with non-interpretable instructions if needed.
When hitting an unreachable instruction, this call should be removed,
but it wasn't. This commit makes sure the call is removed even before
trying to interpret the package init function.
2019-02-05 17:37:55 +01:00
Ayke van Laethem
553f00bdb8 interp: fix uintptr type context in interface
This bug led to a non-obvious validation error after interp had run.
2019-02-05 17:37:55 +01:00
Ayke van Laethem
a789108926 test: add -short flag that only tests on the host 2019-02-05 17:37:55 +01:00
Ayke van Laethem
d63ce0646c compiler: avoid all debug info with -no-debug 2019-02-05 17:37:55 +01:00
Ayke van Laethem
003211b4ff
reflect: implement Value.Set*() for basic types 2019-02-05 17:11:09 +01:00
Ayke van Laethem
e6720d7ddc
compiler: add support for comparing complex numbers 2019-02-05 17:11:09 +01:00
Ayke van Laethem
dfef168139
reflect: add limited support for all type kinds
This commit makes sure all Go types can be encoded in the interface type
code, so that Type.Kind() always returns a proper type kind for any
non-nil interface.
2019-02-05 17:11:09 +01:00
Ayke van Laethem
101f2e519b
compiler: add support for zero channel constant 2019-02-05 17:11:09 +01:00
Ayke van Laethem
eb34afde4b
amd64: align on 16 bytes instead of 8
Some instructions emitted by LLVM (like movaps) expect 16-byte
alignment, while the allocator assumed that 8-byte alignment is good
enough.

TODO: this issue came to light with LLVM optimizing a complex128 store
to the movaps instruction, which must be aligned. It looks like this
means that the <2 x double> IR type is actually 16-byte aligned instead
of 8-byte like a double. If this is the case, the alignment of complex
numbers needs to be updated in the whole compiler.
2019-02-05 17:11:09 +01:00
Ayke van Laethem
63f2a3dfe9
reflect: support slices and indexing of strings and slices 2019-02-05 17:11:09 +01:00
Ayke van Laethem
fb23e9c212
reflect: add support for non-named basic types 2019-02-05 17:11:09 +01:00
Ayke van Laethem
222c4c75b1
test: check for errors when globbing test packages 2019-02-05 17:11:08 +01:00
Ayke van Laethem
5a509f5bfe
compiler: support some more types in interfaces 2019-02-05 17:11:08 +01:00
Ayke van Laethem
2e46275c45
compiler: support complex64 constants 2019-02-05 17:11:08 +01:00
Ayke van Laethem
1d34f868da
compiler: sort interface type codes in reverse order
This makes sure the most commonly used types have the lowest type codes.
This was intended to be the case, but apparently I forgot to sort them
the right way.
2019-02-05 17:11:08 +01:00
Ayke van Laethem
f0904779a5
reflect: add reflect.TypeOf
This is the beginning of true reflection support in TinyGo.
2019-02-05 17:11:08 +01:00
Samuel Lang
70f1064f36 making Docker build resilient (#168)
Currently, if the user hasn't run
`git submodule update --init` beforehand, the docker build will fail

This little addition makes the build atomic and ready for automatic CI tests for the future
2019-02-05 15:57:52 +01:00