compiler: add support for channel operations

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.
This commit is contained in:
Ayke van Laethem
2019-01-13 17:05:00 +01:00
parent 602c264749
commit 2e4dd09bbc
8 changed files with 502 additions and 11 deletions
+4 -3
View File
@@ -51,10 +51,11 @@ func makeGoroutine(*uint8) *uint8
// State/promise of a task. Internally represented as:
//
// {i8* next, i32/i64 data}
// {i8* next, i1 commaOk, i32/i64 data}
type taskState struct {
next *coroutine
data uint
next *coroutine
commaOk bool // 'comma-ok' flag for channel receive operation
data uint
}
// Queues used by the scheduler.