[fpc-pascal] [Lazarus] Running FPC in the browser...

Michael Van Canneyt michael at freepascal.org
Sun Oct 29 11:02:24 CET 2023



On Sat, 28 Oct 2023, Wayne Sherman via fpc-pascal wrote:

> On Sun, Oct 22, 2023 at 3:20 AM Michael Van Canneyt wrote:
>> Thanks to the efforts of Nikolay Nikolov, the FPC compiler can now recompile
>> itself to webassembly
>
> I just watched an interesting talk from StrangeLoop called:
>
> "Inside the Wizard Research Engine" by Ben L. Titzer
> https://www.youtube.com/watch?v=43ENxjq2Vhc
>
> The Wizard Research Engine is a WASM interpreter for research and
> analysis that can help compiler and program writers analyze and debug
> their code.  It can be used to perform WASM code coverage, branch
> profiling, memory/cache profiling, dynamic call graph construction,
> debug breakpoints, watchpoint, tracing and fuzzing and fault
> injection. (see talk @ 11:14 and 13:54)
>
> Wizard: An advanced WebAssembly Engine for Research
> https://github.com/titzer/wizard-engine

Thank you. I didn't know this one yet !

The WebAssembly eco system is already so big, there are really great tools
our there. I've reduced FPC generated modules to 1/3rd of their size, and
the resulting webassembly runs faster than the original FPC generated
(webassembly) code.

With the wasmtime or wasmedge library, Lazarus could integrate the FPC
compiler into the lazarus binary: the module needs to be loaded only once,
and can be executed as often as necessary. One can even imagine compiling
packages in parallel in separate threads. Output can be read directly, no
need to use processes, pipes etc.

Some benchmarking is of course needed to see if there is a speed benefit.

And we're just at the beginning.

I would not be surprised to see that webassembly will eventually make the 
JVM and C# runtime engines redundant...

Michael.


More information about the fpc-pascal mailing list