mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
compiler: always use fat function pointers with context
This reduces complexity in the compiler without affecting binary sizes too much. Cortex-M0: no changes Linux x64: no changes WebAssembly: some testcases (calls, coroutines, map) are slightly bigger
This commit is contained in:
+5
-8
@@ -77,14 +77,11 @@ interface
|
||||
interface.go for a detailed description of how typeasserts and interface
|
||||
calls are implemented.
|
||||
|
||||
function pointer
|
||||
A function pointer has two representations: a literal function pointer and a
|
||||
fat function pointer in the form of ``{context, function pointer}``. Which
|
||||
representation is chosen depends on the AnalyseFunctionPointers pass in
|
||||
`ir/passes.go <https://github.com/aykevl/tinygo/blob/master/ir/passes.go>`_:
|
||||
it tries to use a raw function pointer but will use a fat function pointer
|
||||
if there is a closure or bound method somewhere in the program with the
|
||||
exact same signature.
|
||||
function value
|
||||
A function value is a fat function pointer in the form of ``{context,
|
||||
function pointer}`` where context is a pointer which may have any value.
|
||||
The function pointer is expected to be called with the context as the last
|
||||
parameter in all cases.
|
||||
|
||||
goroutine
|
||||
A goroutine is a linked list of `LLVM coroutines
|
||||
|
||||
Reference in New Issue
Block a user