mps icon indicating copy to clipboard operation
mps copied to clipboard

Initial WebAssembly support.

Open waywardmonkeys opened this issue 3 years ago • 8 comments

Fixes #168.

waywardmonkeys avatar Feb 24 '23 07:02 waywardmonkeys

I meant for this to be a draft. I will be pushing or force-pushing to it over the coming days / weeks.

waywardmonkeys avatar Feb 24 '23 07:02 waywardmonkeys

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:

eventtxt.c:162:3: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
  EVENT_CLOCK_MAKE(val, low, high);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./clock.h:162:35: note: expanded from macro 'EVENT_CLOCK_MAKE'
  ((lvalue) = ((EventClock)(high) << 32) + ((EventClock)(low) & (0xfffffffful)))
                                  ^  ~~
1 error generated.

waywardmonkeys avatar Feb 26 '23 16:02 waywardmonkeys

This is a more interesting build error

Are you not getting a 64-bit unsigned long long? https://github.com/Ravenbrook/mps/blob/142999bd7b0d265ea793817d662047953e4e13ab/code/clock.h#L111

rptb1 avatar Feb 27 '23 09:02 rptb1

That's line 111, the error was on line 162, which is the mps_clock_t code path ... mps_clock_t is mps_word_t

waywardmonkeys avatar Feb 27 '23 09:02 waywardmonkeys

Ah yes. Looks like a 64-bit assumption has crept in here https://github.com/Ravenbrook/mps/blob/142999bd7b0d265ea793817d662047953e4e13ab/code/clock.h#L156-L162 but since https://github.com/Ravenbrook/mps/blob/142999bd7b0d265ea793817d662047953e4e13ab/code/mps.h#L77 we could switch here on MPS_WORD_WIDTH or define MPS_CLOCK_WIDTH to be MPS_WORD_WIDTH and switch on that.

rptb1 avatar Feb 27 '23 09:02 rptb1

EVENT_CLOCK_MAKE is only used in https://github.com/Ravenbrook/mps/blob/142999bd7b0d265ea793817d662047953e4e13ab/code/eventtxt.c#L152-L166 which is intended to only be run on the same platform as the MPS that generated the telemetry, though we might be able to make it more flexible.

rptb1 avatar Feb 27 '23 09:02 rptb1

JPH+RB: This needs CI before merging but currently not a high priority to merge, not currently impacting customers. Assigning importance "optional".

thejayps avatar Mar 20 '23 10:03 thejayps

JPH+RB: This needs CI before merging but currently not a high priority to merge

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 ...

waywardmonkeys avatar Mar 20 '23 11:03 waywardmonkeys