Difference between revisions of "WebAssembly/Goto"

From Lazarus wiki
Jump to navigationJump to search
(Initial version of the page)
 
(Added category and "See also")
 
Line 8: Line 8:
 
Goto support was added in commit 376de92a50259f77e0dc0e1fc3f7d07135547bbc.
 
Goto support was added in commit 376de92a50259f77e0dc0e1fc3f7d07135547bbc.
 
The current implementation resolves goto and branches, using a state machine, which is correct, but not very good in terms of speed. In the future, we might implement a faster algorithm (Stackifier).
 
The current implementation resolves goto and branches, using a state machine, which is correct, but not very good in terms of speed. In the future, we might implement a faster algorithm (Stackifier).
 +
 +
==See Also==
 +
*[[WebAssembly]]
 +
[[Category:WebAssembly]]

Latest revision as of 02:51, 25 October 2023

This article is about the implementation of Goto for the WebAssembly target in FPC.

The problem

Goto is difficult to implement, due to WebAssembly's lack of labels and jumps. It requires all gotos to be converted to structured flow, such as loops and break/continue. This requires implementing a complex algorithm, such as Relooper or Stackifier. Useful read: [1]

FPC's implementation

Goto support was added in commit 376de92a50259f77e0dc0e1fc3f7d07135547bbc. The current implementation resolves goto and branches, using a state machine, which is correct, but not very good in terms of speed. In the future, we might implement a faster algorithm (Stackifier).

See Also