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

[4.0] Remove global WASM::check_limits and initial memory from instantiate_module #975

Merged
merged 5 commits into from
Apr 5, 2023

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Apr 5, 2023

Resolved #969

#969 identified global scoped_skip_checks can be accessible by multiple read-only threads. This variable is not needed in wasm_interface_impl::get_instantiated_module.

Another finding was initial memory argument in instantiate_module was not needed in all the instantiate_module methods. I double checked that it was un-named in all the implementations of instantiate_module. Safe to remove.

This PR removed both of them.

@linh2931 linh2931 requested review from heifner and spoonincode April 5, 2023 17:53
@@ -180,7 +162,6 @@ namespace eosio { namespace chain {
try {
Serialization::MemoryInputStream stream((const U8*)bytes.data(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove all of this section

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oha, thanks! that's the reason of the test failure.

@@ -177,20 +159,8 @@ namespace eosio { namespace chain {
std::vector<U8> bytes = {
(const U8*)codeobject->code.data(),
(const U8*)codeobject->code.data() + codeobject->code.size()};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of bytes too? could be up to 1MB, on the big side for a needless copy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. bytes is not needed any more. Removing it saves an unnecessary copy.

@spoonincode
Copy link
Member

@heifner my hunch is this solves #964 (comment) because it ought to make WAVM only ever touched on a single thread (...in a process). If it's easy to retest would be interesting to confirm.

@@ -174,23 +156,8 @@ namespace eosio { namespace chain {
});
trx_context.pause_billing_timer();
IR::Module module;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more line here that can get the chop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I should be more thorough. Don't know why my build did not show unused variables warning.

@heifner
Copy link
Member

heifner commented Apr 5, 2023

@heifner my hunch is this solves #964 (comment) because it ought to make WAVM only ever touched on a single thread (...in a process). If it's easy to retest would be interesting to confirm.

Yes, it was rather easy to reproduce, I'll re-test with this PR, merged with wasmif_methods_4_0.

Copy link
Member

@spoonincode spoonincode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I've made note in #673 to remove WASM::check_limits entirely at that time

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

Successfully merging this pull request may close these issues.

remove/refactor global WASM::check_limits which is accessed from multiple threads
3 participants