WebAssembly progress

Update on job interview

It was postponed 2 days to Wednesday. I’ll try to keep you up-to-date though.

2 week trial run starts today.

16 Likes

Good luck Sir.

4 Likes

Best of luck there @SamuraiCrow ! :ok_hand:

1 Like

Re:job status
I see that the milestone on the contracting website that Wasmer’s leader assigned to me in the original 2 week trial is still up and valid. (I thought it would expire after a month.) It is 100% C++, mostly C++17 to be precise. And the majority of it is trying to get a recent version of LLVM to compile to WASI standard WebAssembly. Unfortunately WASI doesn’t have multithreading yet so it is not practical to do in Wasmer.

In the meantime I’ll be brushing up on my C++ programming skills, using smart pointers and unordered maps, in preparation for the day that Wasmer gets multithreading capabilities.

Re:Rust and WebAssembly programming on Haiku
I’ll pick up Rust programming after my C++ project is complete. If I’m not an employee at Wasmer, I’ll at least try to be good enough as a contracter to be a go-to guy on special occasions. I still want to get Wasmer working on Haiku.

I’m sorry if I’ve let you down but I’m not allowed to give up.

2 Likes

So you did get a job or not?

What was going to be my test to getting the job has been placed on letsdeel.com with the amount equuivalent to a signing bonus. That makes me an outside contractor.

My intuition says, they plan to string you along

I’m currently blocked. I need Wasmer to add multithreading capabilities or at least a multitasking API to its WASI runtimes before I can proceed. Version 3.0 is slated to add the experimental multithreading API so I can commence soon. In the meantime I’m training up on Rust and C++17 using RAII allocation techniques. I don’t want to say too much because they are working with me so far.

If they aren’t paying you, cut your losses, if they are, win

My losses were cut long before I even applied for the job.

After reviewing my Deel.com account, I discovered there were no milestones associated with my payment meaning that I was paid for my time and they cut their losses. At least I got paid.

Now I hope I posted this comment in the right discussion.

1 Like

Looks like v3 is out at least in beta form.

3 Likes

Sweet! I’ll try it tomorrow morning!

2 Likes

Update:

Preliminary port of W2C2 has been initiated. See the GitHub fork for more information. Since the lstat fallback is still required on some Linux filesystems also, I submitted a pull request upstream.

Now Merged!

5 Likes

Update:

Package for W2C2 should be available on all Haiku platforms soon via HaikuPorts. Although it is prerelease condition and the WASI standarids aren’t fully implemented yet, it’s a fairly small transpiler program and can be used to convert WASI compliant WebAssembly modules to ANSI/ISO C 1989 source code for compilation by HaikuPorts into native packages.

One notable limitation inherant to the WASI standard is that the C setjmp.h header and linker runtimes aren’t implemented in the WebAssembly bytecode yet. This means that C++ programs that use exception handling also can’t be compiled to or from WebAssembly yet. There is a standards committee working on this currently. Their progress can be monitored on their GitHub project.

My Future Hopes

If all goes well with W2C2 and the Exception-Handling standard, I would like to try to convert W2C2 to a proper GCC frontend. If that’s successful, integration with the HaikuDepot may be brought into range. That might include the GCC2 compiler of Haiku x86 if the name mangling support is available for a modern GCC. Otherwise, I just may need to use the existing ANSI C backend indefinitely with the ANSI C frontend of GCC which will work more universally.

4 Likes

Sounds like a significant milestone! I’m a bit confused however: I thought the idea was to use web assembly as an object code format, in order to have cross platform binaries? So you’d compile C/C++ to web assembly and implement a run time that can handle them? But this seems to be going the other way.

As the WASI standard develops, the runtimes will develop with it. W2C2 is a passthrough that uses C1989 as a backend. If you compile C++20 to WebAssembly the distribution medium will be portable with its runtimes either linked in or supplied as another WebAssembly module. The module format is used for executable code or its dependencies as libraries.

Under the “My Future Hopes” heading in my previous post, I mentioned thinking I could use the W2C2 parser to create a proper GCC frontend. What I mean by that is that the whole intermediate step of generating C and parsing C is cut out of the process and the WebAssembly feeds directly into the GNU Compiler Collection (GCC) framework of compilers and runtimes. This is a stepping stone toward that.

Correction From My Previous Post

In my previous post I nearly contradicted myself by stating that the GCC frontend would bring WebAssembly into range of being incorporated into the package manager. Then I turned around and said that if GCC2 couldn’t handle the frontend, I’d just have to use the C utility and C compiler to implement it. That’s backwards thinking. I should use the existing W2C2 and GCC C compiler first and THEN see about making a proper WebAssembly parser for GCC.

The steps to implementing a WASI compliant WASM32 bytecode package format would be more akin to making a source package build a recipe on the destination platform. Unlike the Gentoo Linux strategy, however, cutting text-based parsers out of the pipeline will shorten the compile times to something more closely resembling something reasonable. WebAssembly bytecode should parse more quickly than C source and making it compile to object codes directly will speed things up as well.

2 Likes

Update:

After last night’s fix of the parallel build system, W2C2 has converted Python 3.11 to multiple C source files such that they can be built using make -j8 on my system. I’ve actually run a debug build of the resultant binary! My thanks go out to Turbolent on GItHub for working on this project! I’m going to try to clean up the Makefile a little better to eliminate a currently necessary step in the build process.

2 Likes

This deserves a screenshot. Slightly modified the Makefile for size optimization instead of debug build and this was the outcome:

3 Likes