WebAssembly/Goto
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
From the Free Pascal wiki, page "WebAssembly/Goto", as it stood on 2023-10-25 after a change by Nickysn, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Edited on wiki.freepascal.org by 1 person, 2023
From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.
| When | Who | What changed |
|---|---|---|
| Nickysn | Initial version of the page | |
| Nickysn | Added category and "See also" |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
