aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/channel.go
AgeCommit message (Collapse)Author
2023-03-24feat: fix typosshivay
2020-05-27compiler: fix a few crashes due to named typesAyke van Laethem
There were a few cases left where a named type would cause a crash in the compiler. While going through enough code would have found them eventually, I specifically looked for the `Type().(` pattern: a Type() call that is then used in a type assert. Most of those were indeed bugs, although for some I couldn't come up with a reproducer so I left them as-is.
2020-05-12runtime: add cap and len support for chanscornelk
2020-05-09testdata: replace fake waitgroup in channel.go with sync.WaitGroupJaden Weiss
2020-04-13runtime (chan): fix blocking select on a nil channelJaden Weiss
Previously, a blocking select on a nil channel would result in a nil panic inside the channel runtime code. This change fixes the nil checks so that the select works as intended.
2020-03-13compiler,runtime: check for channel size limitsAyke van Laethem
This patch is a combination of two related changes: 1. The compiler now allows other types than `int` when specifying the size of a channel in a make(chan ..., size) call. 2. The compiler now checks for maximum allowed channel sizes. Such checks are trivially optimized out in the vast majority of cases as channel sizes are usually constant. I discovered this issue when trying out channels on AVR.
2019-11-04add blocking selectJaden Weiss
2019-09-22Improved blocking (#513)Jaden Weiss
core: major improvements to blocking, including support for buffered channels.
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-06-12compiler,runtime: implement non-blocking selectsAyke van Laethem
Blocking selects are much more complicated, so let's do non-blocking ones first.
2019-05-14compiler: implement comparing channel valuesAyke van Laethem
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-03-23all: implement trivial select statementsAyke van Laethem
Implement two trivial uses of the select statement. Always blocking: select {} No-op: select { default: } Go 1.12 added a `select {}` instruction to syscall/js, so this is needed for Go 1.12 support. More complete support for select will be added in the future.
2019-01-21compiler: add support for channel operationsAyke van Laethem
Support for channels is not complete. The following pieces are missing: * Channels with values bigger than int. An int in TinyGo can always contain at least a pointer, so pointers are okay to send. * Buffered channels. * The select statement.