Skip to content

Commit 0071ef2

Browse files
aykevldeadprogram
authored andcommitted
concepts: update goroutine information on datatypes page
The information there is way out of date. This gets it up to date with the current state of the compiler and runtime.
1 parent 5c32484 commit 0071ef2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/docs/concepts/compiler-internals/datatypes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ may be a real pointer or an arbitrary number, depending on the target platform.
3232
### goroutine
3333
Goroutines are implemented differently depending on the platform.
3434

35-
* For most platforms, it is implemented as a linked list of [LLVM coroutines](https://llvm.org/docs/Coroutines.html). Every blocking call will create a new coroutine and pass itself to the coroutine as a parameter (see [calling convention]({{<ref "calling-convention.md">}})). The callee then re-activates the caller once it would otherwise return to the parent. Non-blocking calls are normal calls, unaware of the fact that they're running on a particular goroutine. For details, see [src/runtime/scheduler.go](https://github.com/tinygo-org/tinygo/blob/release/src/runtime/scheduler.go). This is rather expensive but has the advantage of being portable and requiring only a single stack.
36-
* For Cortex-M (which includes most supported microcontrollers as of this time), a real stack is allocated and scheduling happens much like the main Go implementation by saving and restoring registers in assembly.
35+
* For most platforms, it is implemented as a lightweight thread similar to the main Go runtime. This means a stack is allocated per goroutine and switching between them happens by saving and restoring all registers. If the stack is too small and a stack overflow happens, you can adjust the stack size. For example, if you want an 8kB stack you can use `-stack-size=8KB`.
36+
* For WebAssembly, we use [Asyncify](https://kripken.github.io/blog/wasm/2019/07/16/asyncify.html). This works most of the time, but can result in some weird edge cases.

0 commit comments

Comments
 (0)