Skip to content
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

wasm memory snapshot #7

Open
seanavery opened this issue Oct 29, 2019 · 4 comments
Open

wasm memory snapshot #7

seanavery opened this issue Oct 29, 2019 · 4 comments

Comments

@seanavery
Copy link
Member

Goal:

  1. At the end of each block snapshot memory and save to disk.
  2. At the beginning of each block, rehydrate wasm vm with the previous memory snapshot

Resources

  1. How to overwrite wasm memory https://stackoverflow.com/questions/55921774/share-webassembly-memory-between-module-instances
  2. wasm-persist https://github.com/dfinity/wasm-persist/blob/master/index.js
@seanavery
Copy link
Member Author

seanavery commented Oct 30, 2019

Strategy 1:

Add javascript to the emscripten module output that handles initializes with a certain memory buffer.

This can be achieved using the --pre-js flag to add javascript code to the js output.

https://emscripten.org/docs/tools_reference/emcc.html#emcc-pre-js

https://emscripten.org/docs/api_reference/module.html#id1

@seanavery
Copy link
Member Author

Should be able to replace memory buffer using Module.buffer

https://emscripten.org/docs/api_reference/module.html#Module.buffer

@seanavery
Copy link
Member Author

seanavery commented Nov 7, 2019

Strategy 2:

Simply use c++ delete to garbage collect the class

c++ delete
embind delete

@seanavery
Copy link
Member Author

Strategy 3:

Replace module instance memory. Each module can point to n memories

1-n memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant