WebAssembly progress

That’s exactly what Haiku is missing. Theoretical conjectures.

1 Like

Assuming the ABI allows for name mangling, yes. BeOS did but the name mangling scheme didn’t work on the newer name mangler of GCC3+.

I do think that making a wrapper for BeAPI would be useful for filling in the many gaps of the WASI standard. Presently WASI is just getting around to adding threads and setjmp.h support for exception handling. I’d probably have to ditch WASI in favor of a proprietary format for BeAPI specifics. That means inventing yet another name mangler I think. :persevere: Or at least a name translation layer. :grimacing:

1 Like

I think what the forum is missing is encouragement for new ideas and open discussion. It has plenty of patronising, though.

Hey I didn’t say it is not possible, just pointing out there is one problem with the ABI compatibility, which is not solved by this approach in its current state. My goal is not to discourae this, but to advance the discussion into how this may be solved.

This sets expectations about what’s currently possible, what the possible limitations currently are, and allows to go further into the plans for this.

2 Likes

Understood, and that’s great. To be clear I am only trying to be helpful and encourage new ideas too. I don’t 100% follow the webassembly development but I think it’s very interesting and technically impressive, and there may be useful applications for it even if those aren’t entirely clear yet.

Re: Name Translation Layer

If I were to write a Haiku API for C outputs whose names are in C++ ABI name mangled form, I think I could add a name translation layer to the GCC2 BeAPI to allow greater binary compatibility with BeOS. Does Haiku 32-bit already have such a solution as this or does it just use a secondary ELF loader?

xkcd: Nerd Sniping

1 Like

The path of least resistance is 3 ohms. Now can we get back to WebAssembly progress - #179 by SamuraiCrow ?

1 Like

Get it working under MacOS with Metrowerks C++ (mwcc/mwld) and this might actually be useful for BeOS PowerPC, (which basically uses those exact compilers, albeit a slightly older version.) You can build BeOS apps under Metrowerks IDE on Windows/Mac if the PowerPC compilers are installed. Message me if you want more info.

Let me get it working on systems I currently have. My G4 Mac Mini is running MorphOS exclusively. My G3-based MicroA1 runs AmigaOS4.1FE. Those are my only PowerPC machines.

I was tempted to make an AmigaOS 3.1, 4.1 and MorphOS build of the WASI library. I’m keeping that on hold for now also. A BeBox would be such a collectible I doubt I could afford one even now.

If you already have a BeBox and Mac PPC, I can send you tarballed source and it should build easily. W2C2 is targetted at POSIX first, and not specifically Linux or BSD. The examples supplied work on big and little endian machines. I can send you build instructions that use GCC or Clang but the makefiles should be easily modified.

1 Like

Interesting indeed, network theory :thinking:
(I guess it will be 1 ohm, due to the parallel circuits)

Sorry for the off-topic reply, couldn’t resist :grin:

1 Like

@memsom The original author is working on a Classic Mac version using MetroWorks compiler and CodeWarrior IDE. It’s in the macintosh branch on GitHub - turbolent/w2c2: Translates WebAssembly modules to C but note that my makefile pull request has barely been commented on so mind the extra step in the build process in the readme file.

Is this general enough to work on exotic machines, not quite the Deathstation 9000, but just somewhat more obscure machines. Does the generated code assume it is okay to compare pointers to two different objects, or to generate pointers which point more than one element past an array? Also, does it make assumptions about the width and representation of various integer types? Or try to fit pointers in some integer type and to convert the resulting integers back to pointers without data loss?

Just asking out of curiosity.

Clang can target WebAssembly if that’s what you need to know regarding pointer arithmetic. As far as I know, the only missing header from ANSI/ISO C is setjmp.h and therefore, C++ exceptions also don’t work yet. The 32-bit version of WebAssembly can compile on 64-bit systems also so don’t take pointer sizes for granted.

Also, if you look at the W2C2 repo, it has WASI runtime packages for NextStep, WinXP, MacOS 9 and other old and exotic operating systems.

I was asking about machines on which int is 16 bits, or those that utilize one’s complement (or even sign-magnitude) representation for signed integers, or machines with odd word sizes (i.e. 9 bit chars, 18 bit words, or 24 bit words), or machines where pointer arithmetic outside an object does not work (such as the IBM I), or machines on which NULL is not zero.

All of these machines are supported by Standard C.

If you can get your 16-bit system to stack 2 words together like a 68000 CPU then that’s close enough to 32 bit. 24 bit addressing will work if it pads the addresses with an additional pad byte also. 9 bit bytes will likely not work. On memory protection schemes that don’t allow out-of-bounds memory accesses for structures, YMMV.

The question is whether or not the generated C code will work on systems on which int is 16 bits.

Ok. I think it requires a 32-bit CPU minimum.

Update Time

The W2C2 project is progressing nicely without much help from me. I had turned my attention to the standardization progress within the WASI standards body. It seems that they are almost to the point of having a command-line interfaced text-only application “world” for sections of standards that need to be implemented to do such a program. Previous examples used custom startup code, for example.

The Bad News

It seems that the standards are taking long enough to be implemented that they need accelerating. I don’t think I can make any contributions that will speed things up toward that end, however. The people working on it know what they are doing and standardization is a laborious task. I can’t move things forward more quickly and I can’t demonstrate anything wrong with what’s going on in the industry. This has lead me to believe that I can’t contribute to this cause to the degree I had hoped.

In light of the fact that W2C2 is a good project that is chasing a moving target just as many similar projects I’ve seen also do, I don’t know how to make things any better or faster. As such I am turning my attention away from this project for the time being.

I hope I can still find ways to contribute to the Haiku project in the future but I don’t know how. Thanks for reading my thread this long. Maybe I can figure out some way to contribute in the future.

6 Likes

2 posts were split to a new topic: Wifi problems