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

on_vm_start is called multiple times when multiple plugins exist in a single VM. #192

Open
mathetake opened this issue Aug 21, 2021 · 2 comments

Comments

@mathetake
Copy link
Contributor

WasmBase::start is called for every plugin;

auto plugin_context = wasm_handle->wasm()->start(plugin);

and inside of it ContextBase::onStart is called:

if (!context_ptr->onStart(plugin)) {

that results in calling on_vm_start:

if (wasm_->on_vm_start_) {
// Do not set plugin_ as the on_vm_start handler should be independent of the plugin since the
// specific plugin which ends up calling it is not necessarily known by the Wasm module.
result =
wasm_->on_vm_start_(this, id_, static_cast<uint32_t>(wasm()->vm_configuration().size()))
.u64_ != 0;

@PiotrSikora
Copy link
Member

I think it was done deliberately to retain some backward compatibility, since otherwise only on_vm_start from one plugin would be called, which might result in skipped global initializations, etc.

Having said that, do you have any use for this? I was thinking about completely removing on_vm_start (and vm_configuration) from the ABI, since everything should be scoped to plugins and their configuration.

@mathetake
Copy link
Contributor Author

Having said that, do you have any use for this? I was thinking about completely removing on_vm_start (and vm_configuration) from the ABI, since everything should be scoped to plugins and their configuration.

actually I don't use this, and +1 to the idea that everything should be scoped to plugins. Btw what's your current thoughts on multiple plugins per 1 VM thing? That is somewhat related to that ABI change.

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

2 participants