Sign in Join
Wiki copytemporary

WebAssembly/Roadmap: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: WebAssembly/Roadmap

OldNewLine
1+## Short-Term
2+
3+These steps are critical for completion in order to have WASM a full scope CPU target for FPC compiler.
4+
5+**Feature**
6+
7+**Status**
8+
9+**Description**
10+
11+Assembly (textual wasm)
12+
13+working
14+
15+Pick an assembler utility that's sequence instruction (FPC) friendly
16+
17+FPC should produce a textual assembly file.
18+
19+Currently, FPC uses the LLVM assembler llvm-mc.
20+
21+Linking
22+
23+working
24+
25+Pick a linker utility that's sequence instruction (FPC) friendly.
26+
27+Linker is a moving target. As a new feature is added, the linking needs to be re-verified.
28+
29+Currently, FPC uses the LLVM linker.
30+
31+Basic function calls and local variables
32+
33+working
34+
35+Implement direct function calls, with passing basic parameters (that don't require any memory. I.e. int and floats)
36+
37+Verify float-point values
38+
39+working
40+
41+As the float points are being converted from the textual format. It's necessary to make sure that the proper values are generated. As of now, they appear to work, including + or - infinity and NaNs.
42+
43+Global variables
44+
45+working
46+
47+Implement symbol reference to global variables (basic or complex)
48+
49+Consider linking - as the index of symbols can change. (Wasm binaries are index based )
50+
51+Stack/Call frame support
52+
53+working
54+
55+WebAssembly doesn't have any native stack and/or frame support.
56+
57+It has to be emulated using global and local variables.
58+
59+Blocking issue: <https://github.com/WebAssembly/wabt/issues/1199>
60+
61+Indirect function calls
62+
63+working
64+
65+WebAssembly has a specific way of indirect calls
66+
67+Needed for vmt and procedure variables (callback) calls
68+
69+VMT
70+
71+working
72+
73+Support for calls via virtual method table
74+
75+RTL.Memory Manager
76+
77+working
78+
79+RTL.(Ansi/Wide) String Manager
80+
81+working
82+
83+RTL.WASI.Console I/O
84+
85+working
86+
87+Standard input, standard output and error output (stderr) works on the WASI target.
88+
89+RTL.WASI.Command line parameters
90+
91+working
92+
93+Both ParamStr and ParamCount work.
94+
95+RTL.WASI.Exit codes
96+
97+working
98+
99+Terminating the program with an exit code via halt(XXX) works.
100+
101+RTL.WASI.Randomize
102+
103+working
104+
105+RTL.WASI.File I/O
106+
107+working
108+
109+Working. Minor issues remain, when there's no mapping for the '/' directory. There's currently no official way in WASI to pass the current directory. Relevant upstream development to follow: [1](https://github.com/WebAssembly/wasi-filesystem/issues/24) An alternative we could use is to pass it as an environment variable (e.g. PWD), but it would not be automatic, and there's no similar convention, supported by the WASI C library.
110+
111+RTL.WASI.File I/O.Basic File I/O
112+
113+working
114+
115+This covers basic sequential reading and writing of text and binary files. This includes Assign, Reset, Rewrite, Append, Close, Read, Write, Readln, Writeln, EoF, EoLn, BlockRead, BlockWrite.
116+
117+RTL.WASI.File I/O.ChDir
118+
119+in progress
120+
121+Partially working. Needs more testing. Things left TODO: \#1: in case there's no mapping for '/', support ChDir to the upper unmapped parts of a mapped directory, e.g. if the user has mapped only '/home/someuser', support ChDir to '/' and '/home' as well. TODO \#2: check how Windows paths are implemented and support that, e.g. if needed, support and test paths with drive names e.g. 'C:\\'. Also support paths with backslashes as well as forward slashes, etc.
122+
123+RTL.WASI.File I/O.MkDir
124+
125+working
126+
127+RTL.WASI.File I/O.RmDir
128+
129+working
130+
131+RTL.WASI.File I/O.GetDir
132+
133+working
134+
135+RTL.WASI.File I/O.Erase
136+
137+working
138+
139+RTL.WASI.File I/O.Rename
140+
141+working
142+
143+RTL.WASI.File I/O.Seek
144+
145+working
146+
147+RTL.WASI.File I/O.FileSize
148+
149+working
150+
151+RTL.WASI.File I/O.FilePos
152+
153+working
154+
155+RTL.WASI.File I/O.Truncate
156+
157+working
158+
159+RTL.WASI.DOS.FindFirst/FindNext/FindClose
160+
161+working
162+
163+RTL.WASI.DOS.Environment variables
164+
165+working
166+
167+This includes the environment variables of the DOS unit: GetEnv, EnvCount, EnvStr.
168+
169+RTL.WASI.DOS.GetDate/GetTime
170+
171+working
172+
173+Works, but returns UTC time, instead of local time, because WASI lacks timezone support.
174+
175+RTL.WASI.DOS.GetMsCount
176+
177+working
178+
179+RTL.WASI.DOS.GetFTime
180+
181+working
182+
183+Works, but returns UTC time, instead of local time, because WASI lacks timezone support.
184+
185+RTL.WASI.DOS.SetFTime
186+
187+working
188+
189+Works, but returns UTC time, instead of local time, because WASI lacks timezone support.
190+
191+RTL.WASI.DOS.GetFAttr
192+
193+working
194+
195+RTL.WASI.DOS.FSearch
196+
197+working
198+
199+RTL.WASI.SysUtils unit
200+
201+working
202+
203+Compiles and appears to be working. Needs more testing. Enabling one of the exception handling modes is highly recommended.
204+
205+RTL.WASI.SysUtils.Platform independent utilities
206+
207+working
208+
209+This includes various string and pchar utilities, type helpers, conversion routines (e.g. Format, Trim, IntToStr, StrToInt, ...), generic (not related to the system clock) utilities (e.g. IsLeapYear), etc.
210+
211+RTL.WASI.SysUtils.File I/O
212+
213+working
214+
215+Minor issues may occur if there's no mapping for the '/' directory.
216+
217+RTL.WASI.SysUtils.File I/O.FileOpen
218+
219+working
220+
221+Implemented. Note: Sharing/locking is not supported on WASI. Feature request is here: [2](https://github.com/WebAssembly/WASI/issues/446)
222+
223+RTL.WASI.SysUtils.File I/O.FileCreate
224+
225+working
226+
227+Implemented. Note: Sharing/locking and Unix-style permissions are not supported on WASI.
228+
229+RTL.WASI.SysUtils.File I/O.FileClose
230+
231+working
232+
233+RTL.WASI.SysUtils.File I/O.FileRead
234+
235+working
236+
237+RTL.WASI.SysUtils.File I/O.FileWrite
238+
239+working
240+
241+RTL.WASI.SysUtils.File I/O.FileSeek
242+
243+working
244+
245+RTL.WASI.SysUtils.File I/O.FileTruncate
246+
247+working
248+
249+RTL.WASI.SysUtils.File I/O.DirectoryExists
250+
251+in progress
252+
253+Almost ready. Only thing left TODO: If there's no mapping for '/', but only for a subdirectory, e.g. '/usr/bin', then DirectoryExists('/usr') or DirectoryExists('/') would return false, while it should be expected to return true.
254+
255+RTL.WASI.SysUtils.File I/O.FileExists
256+
257+working
258+
259+RTL.WASI.SysUtils.File I/O.FileAge
260+
261+working
262+
263+Works, but returns UTC time, instead of local time, because WASI lacks timezone support.
264+
265+RTL.WASI.SysUtils.File I/O.FileGetSymLinkTarget
266+
267+working
268+
269+RTL.WASI.SysUtils.File I/O.FindFirst/FindNext/FindClose
270+
271+working
272+
273+RTL.WASI.SysUtils.File I/O.FileGetDate
274+
275+working
276+
277+Works, but returns UTC time, instead of local time, because WASI lacks timezone support.
278+
279+RTL.WASI.SysUtils.File I/O.FileSetDate
280+
281+working
282+
283+Works, but accepts UTC time, instead of local time, because WASI lacks timezone support.
284+
285+RTL.WASI.SysUtils.File I/O.FileGetAttr
286+
287+working
288+
289+RTL.WASI.SysUtils.File I/O.DeleteFile
290+
291+working
292+
293+RTL.WASI.SysUtils.File I/O.RenameFile
294+
295+working
296+
297+RTL.WASI.SysUtils.Environment variables
298+
299+working
300+
301+RTL.WASI.SysUtils.Sleep
302+
303+working
304+
305+RTL.WASI.SysUtils.Date and time functions, related to the system clock
306+
307+working
308+
309+Implemented, but they all work with UTC time, instead of local time, because WASI lacks timezone support.
310+
311+RTL.WASI.SysUtils.GetTickCount/GetTickCount64
312+
313+working
314+
315+RTL.WASI.Classes unit
316+
317+working
318+
319+Compiles and appears to be working. Needs more testing. Enabling one of the exception handling modes is highly recommended.
320+
321+## Long-Term
322+
323+Future improvements for wasm target. Some of those are nice to have, but not critical. Others are difficult to implement or need features of WebAssembly, which haven't been standardized yet.
324+
325+| Feature | Status | Description |
326+|----|----|----|
327+| WebAssembly Globals | in progress | These are in the planning phase. Main article: [[WebAssembly/Globals]] |
328+| Debug Info | in progress | There's experimental DWARF support for WebAssembly, but it isn't working yet and the debugging tools for WebAssembly aren't very mature at this point even for C and C++. |
329+| Internal Object Writer | working | Enabled by default in commit bc76487b878e59133ce3c2cc19ebb13f9a9826ea |
330+| Internal Linker | working | Enabled by default in commit e3f4bad1646c9b16fdd672707c0145fdaa356d38 |
331+| GOTO support | working | Main article: [[WebAssembly/Goto]] |
332+| non-local GOTO | not implemented | Non-local GOTO is special and needs an implementation, more similar to the exceptions support. |
333+| Exceptions support (no exceptions mode) | working | By default, exceptions are disabled. However, try..finally blocks still work and execute their finally section, even when using the 'exit', 'break' or 'continue' statements. Try..except blocks are compiled, however the 'except' part is never executed. And invoking 'raise' terminates the program, since exceptions cannot be caught in this mode. |
334+| Exceptions support (native exceptions mode) | working | Requires the exception handling proposal: [3](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md) Information about the browser support for this new experimental feature is available here: [4](https://webassembly.org/roadmap/) |
335+| Exceptions support (branchful exceptions mode) | working | This is a compatibility mode, that implements exception support by adding branching after each function call. This incurs a large runtime cost, but is compatible with all WebAssembly implementations and doesn't require the WebAssembly implementation to be JavaScript hosted. This is the only approach, that currently works with wasmtime. |
336+| Exceptions support (JavaScript-based exceptions handling mode) | not implemented | This is the compatibility mode, used by Emscripten. This also incurs a runtime cost, and also requires the WebAssembly implementation to be JavaScript-based, so this is not supported by wasmtime. In this mode, each function call inside a try block is wrapped inside a JavaScript function call, that wraps the WebAssembly function in a try .. catch JavaScript statement block. |
337+| Timezone support | not implemented | WASI currently lacks timezone support. This also applies to WASI's C library in the official SDK. It is possible to parse the TZ environment variable, and read the binary timezone data from the file system, in case that is accessible, however this is probably not portable, and isn't done by their C library. Upstream bug reports: [5](https://github.com/WebAssembly/WASI/issues/167) [6](https://github.com/bytecodealliance/wasmtime/issues/1200) [7](https://github.com/WebAssembly/WASI/issues/239) |
338+| Multithreading support | in progress | Main article: [[WebAssembly/Threads]] Threads are not supported in WebAssembly MVP. There is a future proposal here: [8](https://github.com/WebAssembly/threads/blob/main/proposals/threads/Overview.md) It is already implemented in most browsers: [9](https://webassembly.org/roadmap/) However, it is not yet supported by WASI and wasmtime, so there's no spec or API for creating threads. |
339+| Process support - RTL.WASI.DOS.Exec/DosExitCode, fcl-process, etc. | not implemented | WASI does not support starting processes, yet. Proposal is here: [[https://github.com/WebAssembly/WASI/issues/414]] |
340+| RTL.WASI.DOS.DiskFree | not implemented | Not sure if supported by the WASI API. Can be implemented, if an appropriate WASI API is added in the future. |
341+| RTL.WASI.DOS.DiskSize | not implemented | Not sure if supported by the WASI API. Can be implemented, if an appropriate WASI API is added in the future. |
342+| RTL.WASI.SysUtils.DiskFree | not implemented | Not sure if supported by the WASI API. Can be implemented, if an appropriate WASI API is added in the future. |
343+| RTL.WASI.SysUtils.DiskSize | not implemented | Not sure if supported by the WASI API. Can be implemented, if an appropriate WASI API is added in the future. |
344+| RTL.WASI.DOS.SetFAttr | not implemented | Not supported by the WASI API. |
345+| RTL.WASI.SysUtils.File I/O.FileSetAttr | not implemented | Not supported by the WASI API. |
346+| RTL.WASI.DOS.SetDate/SetTime | not implemented | Setting the system clock is not supported by the WASI API. Can be implemented, if an appropriate WASI API is added in the future. |
347+
348+## See Also
349+
350+- [[WebAssembly]]
351+
352+---
353+*From the Free Pascal wiki, page "WebAssembly/Roadmap", as it stood on 2024-01-11 after a change by Alextpp, 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](/wiki-contact).*
354+Category: WebAssembly

Back to history