Difference between revisions of "WebAssembly/Roadmap"
Line 136: | Line 136: | ||
|This includes the environment variables of the DOS unit: GetEnv, EnvCount, EnvStr. Not yet implemented. | |This includes the environment variables of the DOS unit: GetEnv, EnvCount, EnvStr. Not yet implemented. | ||
|- | |- | ||
− | |RTL.WASI.DOS.GetDate | + | |RTL.WASI.DOS.GetDate/GetTime |
|class="not"|not implemented | |class="not"|not implemented | ||
|Not yet implemented. | |Not yet implemented. | ||
|- | |- | ||
− | + | |RTL.WASI.DOS.SetDate/SetTime | |
− | |||
− | |||
− | |||
− | |RTL.WASI.DOS.SetDate | ||
− | |||
− | |||
− | |||
− | |||
|class="not"|not implemented | |class="not"|not implemented | ||
|Not yet implemented. | |Not yet implemented. |
Revision as of 20:14, 23 June 2021
Short-Term
These steps are critical for completion in order to have wasm a full scope CPU target for FPC compiler
Feature | Status | Description |
---|---|---|
Assembly (textual wasm) | working | Pick an assembler utility that's sequence instruction (FPC) friendly
FPC should produce a textual assembly file. Currently, FPC uses the LLVM assembler llvm-mc. |
Linking | working | Pick an linker utility that's sequence instruction (FPC) friendly.
Linker is a moving target. As a new feature is added, the linking needs to be re-verified. Currently, FPC uses the LLVM linker. |
Basic function calls and local variables | working | Implement direct function calls, with passing basic parameters (that don't require any memory. I.e. int and floats) |
Verify float-point values | working | 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. NaN with payload is not supported yet, see long term goals. |
Global variables | working | Implement symbol reference to global variables (basic or complex)
Consider linking - as the index of symbols can change. (Wasm binaries are index based ) |
Stack/Call frame support | working | WebAssembly doesn't have any native stack and/or frame support.
It has to be emulated using global and local variables. Blocking issue: https://github.com/WebAssembly/wabt/issues/1199 |
Indirect function calls | working | WebAssembly has a specific way of indirect calls
Needed for vmt and procedure variables (callback) calls |
VMT | working | Support for calls via virtual method table |
RTL.Memory Manager | working | |
RTL.(Ansi/Wide) String Manager | working | |
RTL.WASI.Console I/O | working | Standard input, standard output and error output (stderr) works on the WASI target. |
RTL.WASI.Command line parameters | working | Both ParamStr and ParamCount work. |
RTL.WASI.Exit codes | working | Terminating the program with an exit code via halt(XXX) works. |
RTL.WASI.Randomize | not implemented | Not yet implemented. |
RTL.WASI.File I/O | in progress | The WASI target needs a mechanism for converting path names (both relative and absolute) to paths, relative to a given set of preopened directories (these are the directories you're given access to). Also, the concept of current directory needs to be emulated, too. This is partially implemented now, although changing the current directory is not yet implemented.
Relevant upstream development to follow: [1] |
RTL.WASI.File I/O.Basic File I/O | working | 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. Working. |
RTL.WASI.File I/O.ChDir | not implemented | Not yet implemented. |
RTL.WASI.File I/O.MkDir | working | Creating a directory works. |
RTL.WASI.File I/O.RmDir | working | Deleting an empty directory works. |
RTL.WASI.File I/O.GetDir | working | Getting the current directory is emulated. |
RTL.WASI.File I/O.Erase | working | Deleting a file works. |
RTL.WASI.File I/O.Rename | working | Renaming a file works. |
RTL.WASI.File I/O.Seek | working | Seeking inside an open file works. |
RTL.WASI.File I/O.FileSize | working | Getting the size of a file works. |
RTL.WASI.File I/O.FilePos | working | Getting the current position in a file works. |
RTL.WASI.File I/O.Truncate | working | Truncating a file works. |
RTL.WASI.DOS.FindFirst/FindNext/FindClose | not implemented | Not yet implemented. |
RTL.WASI.DOS.Environment variables | not implemented | This includes the environment variables of the DOS unit: GetEnv, EnvCount, EnvStr. Not yet implemented. |
RTL.WASI.DOS.GetDate/GetTime | not implemented | Not yet implemented. |
RTL.WASI.DOS.SetDate/SetTime | not implemented | Not yet implemented. |
RTL.WASI.SysUtils unit | in progress | Unit compiles, but is untested. The file operations are not yet implemented. Additionally, the compiler still doesn't support exceptions, which can cause problems with this unit. |
RTL.WASI.Classes unit | in progress | Unit compiles, but is untested. Additionally, the compiler still doesn't support exceptions, which can cause problems with this unit. |
Long-Term
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.
Feature | Status | Description |
---|---|---|
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++.
There's an LLVM linker bug, related to generating linker map files: [2] |
Internal Writer | not implemented | The binary wasm format is well defined and could be implemented within FPC |
Internal Linker | not implemented | |
GOTO support | not implemented | 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: [3] |
Exceptions support | not implemented | Exceptions for WebAssembly are not standardized yet. FPC's default implementation relies on setjmp/longjmp, which are not available in WebAssembly. |
Advanced floating point NaNs | not implemented | Specifying custom NaN immediate values - NaNs with payload, signalling and quiet NaNs are not supported yet, because llvm-mc doesn't seem to accept them, or I don't know the syntax. I'm not sure whether this feature is necessary, or whether you can actually specify a NaN constant with a payload in Free Pascal anyway. |