mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
all: rewrite goroutine lowering
Before this commit, goroutine support was spread through the compiler. This commit changes this support, so that the compiler itself only generates simple intrinsics and leaves the real support to a compiler pass that runs as one of the TinyGo-specific optimization passes. The biggest change, that was done together with the rewrite, was support for goroutines in WebAssembly for JavaScript. The challenge in JavaScript is that in general no blocking operations are allowed, which means that programs that call time.Sleep() but do not start goroutines also have to be scheduled by the scheduler.
This commit is contained in:
@@ -20,7 +20,7 @@ func main() {
|
||||
systemInit()
|
||||
preinit()
|
||||
initAll()
|
||||
mainWrapper()
|
||||
callMain()
|
||||
abort()
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ func putchar(c byte) {
|
||||
machine.UART0.WriteByte(c)
|
||||
}
|
||||
|
||||
const asyncScheduler = false
|
||||
|
||||
func sleepTicks(d timeUnit) {
|
||||
for d != 0 {
|
||||
ticks() // update timestamp
|
||||
|
||||
Reference in New Issue
Block a user