aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
AgeCommit message (Collapse)Author
2019-12-30revise defer to use heap allocations when running a variable number of timesJaden Weiss
2019-12-26compiler: fix assertion on empty interfaceAyke van Laethem
This fixes issue #453.
2019-11-17compiler: add support for async interface callsJaden Weiss
2019-11-17add code to handle programs which use heap allocations but never hit the GCJaden Weiss
2019-11-10runtime: only implement CountString for required platformsAyke van Laethem
2019-11-09runtime: implement comparing uintptr values in interfacesAyke van Laethem
This was an oversight in https://github.com/tinygo-org/tinygo/pull/686. With this PR, it's possible to compare interface values that contain values/fields of type uintptr.
2019-11-08cgo: add support for nested structs and unionsAyke van Laethem
2019-11-07cgo: refactor union supportAyke van Laethem
Instead of putting the magic in the AST, generate regular accessor methods. This avoids a number of special cases in the compiler, and avoids missing any of them. The resulting union accesses are somewhat clunkier to use, but the compiler implementation has far less coupling between the CGo implementation and the IR generator.
2019-11-04runtime: implement interface equalityKonstantin Itskov
Code copied from Konstantin Itskov and modified by Ayke van Laethem. For details: https://github.com/tinygo-org/tinygo/pull/569
2019-11-04add blocking selectJaden Weiss
2019-11-02fix miscompile of static goroutine calls to closuresJaden Weiss
2019-10-25compiler: fix interface lowering miscompilation with reflectAyke van Laethem
When using reflect, arbitrary types can be synthesized. This invalidates a few assumptions in the interface-lowering pass, that think they can see all types that are in use in a program and optimize accordingly. The file size impact depends on the specific program. Sometimes it's nonexistent, sometimes it's rather hefty (up to 30% bigger). Especially the samd21 targets seem to be affected, with a 2000-6000 bytes increase in code size. A moderately large case (the stdlib test) increases by 4%/6%/15% depending on the target. I hope that this increase could be mitigated, but I don't see an obvious way to do that.
2019-10-13compiler: support recursive typesAyke van Laethem
Previously, the cycle was broken by inserting an unsafe.Pointer type in some places. This is of course incorrect, and makes debugging harder. However, LLVM provides a way to make temporary nodes that are later replaced, exactly for this purpose. This commit uses those temporary metadata nodes to allow such recursive types.
2019-10-01compiler: support constant indices with a named typeAyke van Laethem
2019-09-24interp: implement runtime.sliceCopyAyke van Laethem
This implements the copy() built-in function. It may not work in all cases, but should work in most cases. This commit gets the following 3 packages to compile, according to tinygo-site/imports/main.go: * encoding/base32 * encoding/base64 * encoding/pem (was blocked by encoding/base64)
2019-09-22Improved blocking (#513)Jaden Weiss
core: major improvements to blocking, including support for buffered channels.
2019-09-20fix bug in IR regarding type aliasesJaden Weiss
2019-08-20reflect: implement t.Comparable()Ayke van Laethem
This is necessary to support the context package, which is a dependency of a lot of packages.
2019-08-19reflect: implement support for array typesAyke van Laethem
2019-08-17compiler: add support for 'go' on func valuesAyke van Laethem
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-15compiler,runtime: implement stack-based schedulerAyke van Laethem
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-11compiler,runtime: implement []rune to string conversionAyke van Laethem
This is used by a few packages in the standard library, at least compress/gzip and regexp/syntax.
2019-08-11compiler: add support for full slice expression for slicing arraysAyke van Laethem
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-11reflect: add support for linked listsAyke van Laethem
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-08reflect: add support for struct typesAyke van Laethem
2019-08-08reflect: add support for Type.Bits()Ayke van Laethem
2019-08-08compiler: make struct types more uniqueAyke van Laethem
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-05reflect: add support for named typesAyke van Laethem
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-05compiler: fix crash with linked lists in interfacesAyke van Laethem
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-04compiler: implement full slice expressionAyke van Laethem
This feature was introduced in Go 1.2 and is used by some standard library packages.
2019-06-19compiler,runtime: implement string to []rune conversionscriptonist
Commit message by aykevl
2019-06-12compiler,runtime: implement non-blocking selectsAyke van Laethem
Blocking selects are much more complicated, so let's do non-blocking ones first.
2019-06-03cgo: add support for anonymous structsAyke van Laethem
2019-06-03cgo: add support for bitfields using generated getters and settersAyke van Laethem
2019-05-24compiler,runtime: fix multiple definitions of a single functionAyke van Laethem
strings.IndexByte was implemented in the runtime up to Go 1.11. It is implemented using a direct call to internal/bytealg.IndexByte since Go 1.12. Make sure we remain compatible with both.
2019-05-17cgo: add support for enum typesAyke van Laethem
Enum types are implemented as named types (with possible accompanying typedefs as type aliases). The constants inside the enums are treated as Go constants like in the Go toolchain.
2019-05-14compiler: implement comparing channel valuesAyke van Laethem
2019-05-14runtime: implement growing hashmapsAyke van Laethem
Add support for growing hashmaps beyond their initial size.
2019-05-14compiler,runtime: use the size hint when creating a new mapAyke van Laethem
It defaults to hint/8 number of buckets. This number may be tuned in the future.
2019-05-13Test for functional argument passing (#336)seph
* Test for functional argument passing
2019-05-12cgo: refactor; support multiple cgo files in a single packageAyke van Laethem
This is a big commit that does a few things: * It moves CGo processing into a separate package. It never really belonged in the loader package, and certainly not now that the loader package may be refactored into a driver package. * It adds support for multiple CGo files (files that import package "C") in a single package. Previously, this led to multiple definition errors in the Go typecheck phase because certain C symbols were defined multiple times in all the files. Now it generates a new fake AST that defines these, to avoid multiple definition errors. * It improves debug info in a few edge cases that are probably not relevant outside of bugs in cgo itself.
2019-05-12cgo: don't crash on `import "C"` without commentAyke van Laethem
This doesn't make a lot of sense, but we shouldn't crash on it.
2019-05-12cgo: add support for #define constantsAyke van Laethem
These are converted to Go constants where possible.
2019-05-11compiler: implement complex divisionAyke van Laethem
This is hard to do correctly, so copy the relevant files from the Go compiler itself. For related discussions: * https://github.com/golang/go/issues/14644 * https://github.com/golang/go/issues/29846
2019-05-11compiler: implement complex multiplicationAyke van Laethem
2019-05-11compiler: add support for complex add and subAyke van Laethem
This is fairly trivial to add and follows the implementation of gc: https://github.com/golang/go/blob/170b8b4b12be50eeccbcdadb8523fb4fc670ca72/src/cmd/compile/internal/gc/ssa.go#L2179-L2192
2019-05-05compiler: allow larger-than-int values to be sent across a channelAyke van Laethem
Instead of storing the value to send/receive in the coroutine promise, store only a pointer in the promise. This simplifies the code a lot and allows larger value sizes to be sent across a channel. Unfortunately, this new system has a code size impact. For example, compiling testdata/channel.go for the BBC micro:bit, there is an increase in code size from 4776 bytes to 4856 bytes. However, the improved flexibility and simplicity of the code should be worth it. If this becomes an issue, we can always refactor the code at a later time.
2019-05-05compiler: support returning values from async functionsAyke van Laethem
This is implemented as follows: * The parent coroutine allocates space for the return value in its frame and stores a pointer to this frame in the parent coroutine handle. * The child coroutine obtains the alloca from its parent using the parent coroutine handle. It then stores the result value there. * The parent value reads the data from the alloca on resumption.
2019-05-01compiler: avoid bitcast when replacing a method call with a direct callAyke van Laethem
A bitcast was inserted when the receiver of the call wasn't a *i8. This is a pretty common case, and did not play well with goroutines. Avoid this bitcast by changing each call to a direct call, after unpacking the receiver type from the *i8 parameter. This might also fix some undefined behavior in the resulting program, as it is technically not allowed to call a function with a different signature (even if the signature is compatible).
2019-05-01cgo: only include the symbols that are necessary (recursively)Ayke van Laethem
Only try to convert the C symbols to their Go equivalents that are actually referenced by the Go code with C.<somesymbol>. This avoids having to support all possible C types, which is difficult because of oddities like `typedef void` or `__builtin_va_list`. Especially __builtin_va_list, which varies between targets.