Upstreaming WASM changes
Thanks for merging my WASM PRs. I'm making this issue to help me keep track of what hasn't been upstreamed yet. All of this stuff is available at: https://github.com/guregu/trealla
- [x] WASM build action: https://github.com/trealla-prolog/trealla/pull/57
- This should help us know when we break the WASM build.
- I'll keep doing releases to WAPM from guregu/trealla until the fork no longer needs to exist.
- [ ] Use Wizer to pre-initialize a global interpreter for WASM
- This brings the startup time of new interpreters from ~180ms to ~5ms in browsers.
- Includes one Apache 2.0 licensed header file. It's a very simple macro so I might just rewrite it to keep us all MIT.
- [ ]
library(js)JSON-based programmatic toplevel & javascript native predicates- [x] Need to split this into 2 modules: JSON toplevel (
js_ask/1) and Javsascript-specific helpers likejs_fetch/3(trealla-prolog/go needs the toplevel but not the JS helpers)
- [x] Need to split this into 2 modules: JSON toplevel (
- [x] ~~JSON related hacks: https://github.com/guregu/trealla/issues/5~~
- Solved in #92
- [ ] Host call stuff:
'$host_call'/2and'$host_resume'/1. These are two native predicates for passing data between guest → host → guest, used for calling JS from Prolog.- Includes Makefile changes to build the pure WASI version and the 'libtpl.wasm' version with host call predicates.
- If we use better WASI libraries for trealla-js, we might not need these at all, and we can use pipes/sockets/whatever instead.
- [ ] Toplevel formatting hacks for WASM/
pl_query.- In
pl_querymode, don't print spaces before var dumps. - In
pl_querymode, always include the dot for terms and don't print "; " on redo, etc. This gives us uniform results in the WASM library query iterators. - For WASM, print warnings to stderr instead of stdout (keeps stdout clean and easy to parse).
- In
- [ ] Export all of
trealla.hand add aquery_did_yieldAPI intrealla.h- Easy with a little macro.
- [ ] Memory streams (#595)
- Implemented in fork, need to port over. Generalization of with_output_to etc. Used to capture stdout/stderr for wasm client.
- [ ]
string/1?- Need predicate for "string but not atom", probably already exists?
Wow, that was a lot of stuff. Anyway, instead of dumping one huge PR on you I will make small ones that add things as they are stabilized. Of course, I'd be happy to change how things work so feel free to reject anything. My aim is to be minimally invasive :-)
How's this at?
Still have lots to do, updated it. I can break it into smaller issues instead of leaving this one open forever if that's preferable (I don't mind either way).
Biggest change will be #595
Leave it as, was just wondering.
On Wed, 18 Sept 2024, 23:15 guregu, @.***> wrote:
Still have lots to do, updated it. I can break it into smaller issues instead of leaving this one open forever if that's preferable (I don't mind either way).
Biggest change will be #595 https://github.com/trealla-prolog/trealla/issues/595
— Reply to this email directly, view it on GitHub https://github.com/trealla-prolog/trealla/issues/58#issuecomment-2358441858, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSEUYVQBLA6CZTZPMOF3ZXF4F7AVCNFSM6AAAAABOM3LEPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJYGQ2DCOBVHA . You are receiving this because you commented.Message ID: @.***>