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

near-vm: Allow straightforward reuse of pre-faulted memory maps for storing executable machine code and wasm memories. #8950

Closed
nagisa opened this issue Mar 21, 2022 · 1 comment
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team

Comments

@nagisa
Copy link
Collaborator

nagisa commented Mar 21, 2022

nearcore's use of the WASM VM is largely single-threaded – it will grab a contract, deserialize it, execute a function therein, and deallocate the resources before moving on.

Today in this scheme one of the cost centres is in creating and faulting-in new memory maps for the executable code and module memory for every contract execution. Our interface should make it possible and straightforward to allocate and prefault the prerequisite memory ahead of time and then just keep writing/reading/executing data from the same memory map.

This, of course, would require to be more careful about e.g. zeroing out the contents of the memory before allowing execution, but it still should be cheaper overall compared to what is being done today.

Related to #8951

@nagisa nagisa transferred this issue from near/wasmer Apr 24, 2023
@nagisa nagisa changed the title Allow straightforward reuse of pre-faulted memory maps for storing executable machine code and wasm memories. near-vm: Allow straightforward reuse of pre-faulted memory maps for storing executable machine code and wasm memories. Apr 24, 2023
@nagisa nagisa added A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team labels Apr 24, 2023
@nagisa
Copy link
Collaborator Author

nagisa commented May 10, 2024

This is solved for executable code. We have also explored this for the data memories, but those have been found to be less obvious of a win. #10851

@nagisa nagisa closed this as completed May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team
Projects
None yet
Development

No branches or pull requests

1 participant