-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial WebAssembly support. #175
base: master
Are you sure you want to change the base?
Conversation
I meant for this to be a draft. I will be pushing or force-pushing to it over the coming days / weeks. |
When compiling with `-s USE_PTHREADS` in emscripten, Posix threads and locks are available (assuming the WebAssembly VM supports this extension). This can be detected at compile time by checking for the preprocessor definition `__EMSCRIPTEN_PTHREADS__`. In the absence of this definition, we request a single threaded configuration which falls back to the implementation in `lockan.c`. This works when building `mps.c`, but does not work when using the older Makefile-based build system as when building `lockix.c` as a standalone file, `mpstd.h` is not included prior to the relevant portion of `config.h` being processed.
This uses GitHub actions and installs the Emscripten SDK's latest version and activates it. At some point, this should probably change to a fixed version that is periodically incremented once some baseline support level is determined. This is just compiling and running what's needed for `amsss` for now until other pieces are in place for building and running more of everything.
3a90345
to
1a2c28c
Compare
This fails still due to threaded tests being built and that failing.
This is a more interesting build error, haven't looked into it yet, requires changes I haven't pushed yet to get to this point:
|
Note that this is only valid as noted in a fixme comment when threads are enabled in emscripten (which is not the default).
Are you not getting a 64-bit Line 111 in 142999b
|
That's line 111, the error was on line 162, which is the |
Ah yes. Looks like a 64-bit assumption has crept in here Lines 156 to 162 in 142999b
but since Line 77 in 142999b
we could switch here on MPS_WORD_WIDTH or define MPS_CLOCK_WIDTH to be MPS_WORD_WIDTH and switch on that.
|
Lines 152 to 166 in 142999b
|
WebAssembly doesn't support `mprotect()` or signals. This will make it hard to support multithreaded or incremental collection for now.
JPH+RB: This needs CI before merging but currently not a high priority to merge, not currently impacting customers. Assigning importance "optional". |
FWIW, it does have some CI... but needs more. But there was an issue with the CI for it because it was building the threaded tests as well ... |
Fixes #168.