WebAssembly progress

UPDATE:

The source code to Haiku is full of preprocessor magic. Of course this defines the architecture long before the bytecode can be generated so every instance of

#ifdef __IM_A_PREPROCESSOR_FLAG
  do this;
#endif

needs to be replaced with

if (__IM_A_BOOLEAN_CONST) {
  do this;
}

so that

#define __IM_A_PREPROCESSOR_FLAG 1

can be repaced with

extern const bool __IM_A_BOOLEAN_CONST;

thus allowing the value of __IM_A_BOOLEAN_CONST to be linked in on the destination machine and the if statement to be constant folded by the link-time optimization pass.

It’ll be monotonous work but more importantly, will touch almost every part of the source code of the operating system. Expensive as a time sink even though the work is easy. I’m guessing that this may not make it to Beta 4, to say the least. Even worse, the GCC2 ABI requirement won’t be met without an alternative compiler that supports link-time optimization.

I will welcome any critique of the situation but the amount of work that will be needed to merge all the packages into one bytecode may have to wait until the “glass elevator” arrives on the first floor. (Meaning that it may have to wait until after release 1.)

Edit: If everybody was willing to pitch in and replace all the preprocessor macros in the config directory with constants, we collectively could make it beta 4!

6 Likes