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

1050 коммитов

Автор SHA1 Сообщение Дата
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
Ayke van Laethem
8d959b7c63 all: replace dep with Go modules
We've moved to go modules, and keeping both working is burdensome.
In fact, I think dep already wasn't working.
2019-09-15 18:04:38 +02:00
Ron Evans
02c4020228 machine/atsamd51: add support for ATSAMD51 processor using Adafruit ItsyBitsy-M4 board
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 17:56:14 +02:00
Ron Evans
bc41cc688f main: check the major/minor installed version of Go before tinygo compile, to ensure that it is a supported version.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 17:50:16 +02:00
Ron Evans
7d481c179f machine/atsamd21: uses different required magic values for BOSSA and UF2 bootloaders
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 16:18:30 +02:00
Ron Evans
69aaea44a0 machine/atsamd21: Add support for bootloader reset/programming and correct error in receiving endpoint 0 data for CDC Set Line Coding changes, implementing system reset on switch to 1200 baud connection speed with DTR false.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 16:18:30 +02:00
Ron Evans
6c1abfe047 device/arm: add support for System Control Block (SCB) registers and SystemReset() function
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 16:18:30 +02:00
Ron Evans
656fb4e372 tools/generator: correctly handle padding when it is 3 bytes long
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-13 00:40:25 +02:00
Ron Evans
f4485f414f uf2: extract target address from ELF to accomodate the differences with M0 vs M4 processors
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-13 00:37:54 +02:00
Phil Kedy
55144ad608 WASM: Support for setting an imported function's module name (#455)
* wasm: add support for setting a function's Wasm import module name by using the //go:wasm-module comment.
2019-09-12 08:35:43 +02:00
Ron Evans
1dbfc976e8 docker: use Go 1.12 base Docker image for compatibility
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-09 09:37:43 +02:00
Ron Evans
e26f0b35e3 machine/atsamd21: correct order of params for USB CDC descriptor
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-06 14:24:32 +02:00
Ron Evans
4ee26fd54b machine/atsamd21: correct issue with invalid first reading coming from ADC
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-06 14:22:24 +02:00
Jaden Weiss
a718b10502 fix sleep queue corruption bug 2019-09-06 14:19:05 +02:00
BCG
8a5fa51f60 Updated SPI pins so that they are configurable, enabling multiple SPI sercoms for ATSAMD21 2019-08-28 11:19:52 +02:00
Elliott Sales de Andrade
7c5f943564 Fix a Python SyntaxWarning.
Using 'is' for literals is incorrect, and only should be done for
singletons.
2019-08-27 14:17:17 +02:00
Ayke van Laethem
7938740bf3 tools: make tools python2 compatible
This allows the tools to be used for Python 2 and Python 3.
2019-08-26 16:39:28 +02:00
Ayke van Laethem
319d21e662 runtime: don't mark the object right before a non-existing object
False positives (pointers that point to nowhere but happen to point into
the heap) would result in the block just before that pointer to be
marked. This is clearly not intended, so ignore such a pointer.
2019-08-25 13:12:27 +02:00
Ayke van Laethem
3bf2487dc5 runtime: add some more asserts to the GC 2019-08-25 13:12:27 +02:00
Ayke van Laethem
6917faabf5 runtime: fix GC to take goroutines into account
This fix is needed because with the new task-based scheduler, the
current stack pointer may not be on the system stack.
2019-08-25 13:12:27 +02:00
Ayke van Laethem
db4de46d88 runtime: add dummy getCurrentStackPointer functions
This is useful for the next commit, to get it to compile on all systems.
2019-08-25 13:12:27 +02:00
Ayke van Laethem
9b1dd8e03d arm7tdmi: clean up architecture definition 2019-08-25 13:12:27 +02:00
Ayke van Laethem
e356bad4d1 reflect: implement t.Comparable()
This is necessary to support the context package, which is a dependency
of a lot of packages.
2019-08-20 10:20:09 +02:00
Ayke van Laethem
c19c738f52 reflect: implement support for array types 2019-08-19 11:08:26 +02:00
Ayke van Laethem
bbc3046687 compiler: add support for 'go' on func values
This commit allows starting a new goroutine directly from a func value,
not just when the static callee is known.

This is necessary to support the whole time package, not just the
commonly used subset that was compiled with the SimpleDCE pass enabled.
2019-08-17 11:51:43 +02:00
Ayke van Laethem
e4fc3bb66a compiler,runtime: fix new task-based scheduler
A bug was introduced in the previous commit that led to miscompilations
in the time.Sleep function when the scheduler was disabled, because
time.Sleep (implemented in the runtime) tried to switch to the scheduler
stack.

This commit restores the binary size of most examples to what it was
before, but still reduces static RAM consumption (.bss) slightly. This
gives me some confidence that it does indeed fix the introduced bug.
2019-08-17 08:42:23 +02:00
Ayke van Laethem
542135c357 compiler,runtime: implement stack-based scheduler
This scheduler is intended to live along the (stackless) coroutine based
scheduler which is needed for WebAssembly and unsupported platforms. The
stack based scheduler is somewhat simpler in implementation as it does
not require full program transform passes and supports things like
function pointers and interface methods out of the box with no changes.

Code size is reduced in most cases, even in the case where no scheduler
scheduler is used at all. I'm not exactly sure why but these changes
likely allowed some further optimizations somewhere. Even RAM is
slightly reduced, perhaps some global was elminated in the process as
well.
2019-08-15 17:31:54 +02:00
Brad Erickson
61f711ef26 Add common test logging methods such as Errorf/Fatalf/Printf
Implements nearly all of the test logging methods for both T and B
structs. Majority of the code has been copied from:
golang.org/src/testing/testing.go
then updated to match the existing testing.go structure.

Code structure/function/method order mimics upstream.

Both FailNow() and SkipNow() cannot be completely implemented,
because they require an early exit from the goroutine. Instead,
they call Error() to report the limitation.

This incomplete implementation allows more detailed test logging and
increases compatiblity with upstream.
2019-08-13 20:59:09 +02:00
Ayke van Laethem
fd3309afa8 compiler,runtime: implement []rune to string conversion
This is used by a few packages in the standard library, at least
compress/gzip and regexp/syntax.
2019-08-11 15:45:35 +02:00
Ayke van Laethem
fea56d4164 compiler: add support for full slice expression for slicing arrays
This was an oversight in the main commit for full slice expressions:
https://github.com/tinygo-org/tinygo/pull/472
This syntax is used by the regexp package, for example.
2019-08-11 15:37:05 +02:00
Ayke van Laethem
ea8e4079bc reflect: add support for linked lists
Linked lists are usually implemented as follows:

    type linkedList struct {
        next *linkedList
        data int // whatever
    }

This caused a stack overflow while writing out the reflect run-time type
information. This has now been fixed by splitting the allocation of a
named type number from setting the underlying type in the sidetable.
2019-08-11 15:00:43 +02:00
Ayke van Laethem
0818a125c0 reflect: fix IsNil and Pointer for addressable pointer types 2019-08-11 15:00:43 +02:00
Brad Erickson
7c758b0dfc testing: Add Benchmark B struct stub
This struct allows test files containing basic benchmarks to compile
and run, but will not run the benchmarks themselves.

For #491
2019-08-11 14:51:02 +02:00
Daniel Esteban
4ea59742d7 CONTRIBUTORS: add name 2019-08-10 22:00:01 +02:00
Ayke van Laethem
b7cb10519c compiler: fix some invalid IR
Compiling LLVM with assertions enabled revealed some bugs in TinyGo that
weren't caught by normal verifying of the LLVM module.
2019-08-09 21:27:23 +02:00
Ayke van Laethem
562ad740da compiler: make runtime.makeGoroutine AVR compatible
Previously it would use a bitcast, which cannot directly be used on AVR
because functions live in a different address space on AVR. To fix this,
use a ptrtoint/inttoptr pair.

This allows testdata/coroutines.go to be compiled, but due to what
appears to be an LLVM bug cannot be optimized and codegen'ed:

    tinygo: /home/ayke/src/github.com/tinygo-org/tinygo/llvm-project/llvm/lib/IR/Constants.cpp:1776: static llvm::Constant *llvm::ConstantExpr::getBitCast(llvm::Constant *, llvm::Type *, bool): Assertion `CastInst::castIsValid(Instruction::BitCast, C, DstTy) && "Invalid constantexpr bitcast!"' failed.

This happens as one of the function passes after the TinyGo passes and
after the module has been verified so most likely it is a bug somewhere
in LLVM.
2019-08-09 21:27:23 +02:00
Kyle Lemons (Loon, LLC)
92206558fb
gameboy-advance: don't crash copying unaligned strings
Strings are emitted in .rodata sections, which are not yet mentioned in the linker script.

I can't exactly explain why it didn't work before, as these sections should have been included in .bss and thus properly aligned, but it appears to work reliably.
2019-08-09 20:14:17 +02:00
Kyle Lemons (Loon, LLC)
fd6b671494
CONTRIBUTORS: Add Loon, LLC for kevlar@loon.com 2019-08-09 20:14:14 +02:00
Ayke van Laethem
e2c8654237 reflect: add support for struct types 2019-08-08 15:23:47 +02:00
Ayke van Laethem
5012be337f reflect: implement Type.Align() 2019-08-08 15:23:47 +02:00
Ayke van Laethem
614433cb75 reflect: implement Type.AssignableTo 2019-08-08 15:23:47 +02:00
Ayke van Laethem
b8cd8b6f25 reflect: add support for Type.Bits() 2019-08-08 15:23:47 +02:00
Ayke van Laethem
f43d01bdc7 compiler: make struct types more unique
There are a lot more fields that are important when comparing structs
with each other. Take them into account when building the unique ID per
struct type.

Example code that differs between the compilers:
https://play.golang.org/p/nDX4tSHOf_T
2019-08-08 15:23:47 +02:00
Ayke van Laethem
9979cf2bbd CONTRIBUTING: add my name 2019-08-08 12:07:49 +02:00
Ayke van Laethem
79b470acee compiler: make goroutine lowering panic message more helpful
This is a workaround for an existing issue, to see which function is to
blame.
2019-08-08 11:59:53 +02:00
Ron Evans
0b7047cc0e governance: add CONTRIBUTORS file to repo
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-08-08 11:59:41 +02:00
Ron Evans
99add1571b docker: Debian stable-slim image now based on buster not stretch, so update the needed package repo used for LLVM.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-08-07 11:27:44 +02:00
Elliott Sales de Andrade
b7f4373681 Fix parsing of beta Go versions. 2019-08-05 17:45:45 +02:00
Ayke van Laethem
95721a8d8c reflect: add support for named types
With this change, it becomes possible to get the element type of named
slices, pointers, and channels.

This is a prerequisite to enable the common named struct types. There's
more to come.
2019-08-05 14:44:30 +02:00
Ayke van Laethem
33dc4b5121 compiler: fix crash with linked lists in interfaces
This commit fixes the following issue:
https://github.com/tinygo-org/tinygo/issues/309
Also, it prepares for some other reflect-related changes that should
make it easier to add support for named types (etc.) in the future.
2019-08-05 14:44:30 +02:00