On Fri, Dec 16, 2022 at 1:29 PM Steve Dekorte <[email protected]> wrote:

>
> I've ported an interpreter for scripting language to WASM using emscripten
> and gotten a REPL working for it in a web page. I'm interested in the
> possibility of making a Smalltalk/LISP like development environment with
> it. There would be other ways to save state in the system, but storing the
> complete system state would be a nice place to start.


Saving the entire state of JS would most likely be hard, but would depend
on what features you use.  Saving the state of the wasm linear memory would
just be a question of saving and restoring the HEADU8 typed array (i.e.
pretty simple).

There are other parts of the running wasm module (in addition to the linear
memory) that might also prove hard to save/restore, such as (mutable) wasm
globals and the wasm table (this last one might be very hard if a user rand
addFunction to add a function to the table at runtime).


> On Friday, December 16, 2022 at 1:10:03 PM UTC-8 [email protected] wrote:
>
>> On Thu, Dec 15, 2022 at 5:09 PM Steve Dekorte <[email protected]> wrote:
>>
>>> Is there JS emscripten API for storing and restoring a WASM system state
>>> (all non-code memory) to/from a buffer? Is there any sample code
>>> demonstrating this?
>>
>>
>> While saving and restoring the entire Wasm memory is relatively straight
>> forward (its just an ArrayBuffer operation), one possible problem you would
>> face is that emscripten stores a lot of its state in JS.  Any kind of
>> save/restore mechanism would likely also need to take that into account.
>> Perhaps you could explain why you are trying to do this and it might make
>> it clear if that would be a problem in your case?
>>
>> cheers,
>> sam
>>
>>
>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/emscripten-discuss/029cdcef-982f-42d3-9ad5-fb5e8e9ebc81n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/emscripten-discuss/029cdcef-982f-42d3-9ad5-fb5e8e9ebc81n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/bdb37f62-ada6-4cc3-a8a1-525ce4927925n%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/bdb37f62-ada6-4cc3-a8a1-525ce4927925n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-VkZCHeaZQTJ7uZRM7BxC0%3Dux3UKN5ykkTpHVhDFNR0A%40mail.gmail.com.

Reply via email to