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

Remove FuncRef registry - WIP #2437

Closed
wants to merge 6 commits into from
Closed

Conversation

MarkMcCaskey
Copy link
Contributor

Intermediate fix for funcref lifetimes:

  • Disable public APIs for funcrefs
  • Scope funcref backing to the Instance itself
  • In the future use reference counting to make things work fully

Review

  • Add a short description of the change to the CHANGELOG.md file

@MarkMcCaskey
Copy link
Contributor Author

Tests are failing, running here to show what is failing:

bors try

bors bot added a commit that referenced this pull request Jun 22, 2021
@bors
Copy link
Contributor

bors bot commented Jun 22, 2021

try

Build failed:

@freesig
Copy link

freesig commented Jun 24, 2021

I'm not sure if this is helpful but I'm seeing very high cpu usage in our application when using wasmer 2.0 and I did a flamegraph. It seems like there is a lock in the FuncDataRegistry::register that is getting hit a lot (about 60% of the cpu usage).
Screen Shot 2021-06-24 at 10 01 30 am

@syrusakbary
Copy link
Member

Thanks for the report @freesig

@MarkMcCaskey
Copy link
Contributor Author

@freesig Thanks! That is very useful to know. Can you provide some more info about your usage pattern? Are you instantiating modules on multiple threads?

This PR should fix that because it removes the lock and FuncDataRegistry

@freesig
Copy link

freesig commented Jun 26, 2021

Yep definitely instantiating on different threads

@syrusakbary
Copy link
Member

bors try

@bors
Copy link
Contributor

bors bot commented Oct 28, 2021

try

Merge conflict.

# Conflicts:
#	lib/engine-dylib/src/artifact.rs
#	lib/engine-staticlib/src/artifact.rs
#	lib/engine-universal/src/artifact.rs
#	lib/engine-universal/src/engine.rs
#	lib/engine/src/artifact.rs
#	tests/lib/engine-dummy/src/artifact.rs
@syrusakbary
Copy link
Member

bors try

bors bot added a commit that referenced this pull request Oct 29, 2021
@syrusakbary syrusakbary marked this pull request as ready for review October 29, 2021 16:01
@syrusakbary syrusakbary self-requested a review as a code owner October 29, 2021 16:01
@bors
Copy link
Contributor

bors bot commented Oct 29, 2021

try

Build failed:

@syrusakbary
Copy link
Member

bors try

bors bot added a commit that referenced this pull request Oct 29, 2021
@bors
Copy link
Contributor

bors bot commented Oct 29, 2021

try

Build failed:

matklad pushed a commit to matklad/wasmer that referenced this pull request Nov 1, 2021
This backports
  wasmerio/wasmer#2437
to fix
  wasmerio/wasmer#2638

On a high-level, Store (global state for the whole wasmer runtime) used
to store pointers to host functions. This was a partial implementation
of the module linking proposal: for that, we need to be able to use
functions *across* several instances, so we need to keep such functions
in some sort of global state.

This commit moves the data to the Instance. This breaks some module
linking related tests, but we are not using that, and the support wasn't
complete anyway.

Note that the actual memory management remains the same:
`Instance::imported_function_envs` is the thing that was and still is
responsible for dropping data related to external functions.
@matklad matklad mentioned this pull request Nov 1, 2021
matklad pushed a commit to matklad/wasmer that referenced this pull request Nov 1, 2021
This backports
  wasmerio/wasmer#2437
to fix
  wasmerio/wasmer#2638

On a high-level, Store (global state for the whole wasmer runtime) used
to store pointers to host functions. This was a partial implementation
of the module linking proposal: for that, we need to be able to use
functions *across* several instances, so we need to keep such functions
in some sort of global state.

This commit moves the data to the Instance. This breaks some module
linking related tests, but we are not using that, and the support wasn't
complete anyway.

Note that the actual memory management remains the same:
`Instance::imported_function_envs` is the thing that was and still is
responsible for dropping data related to external functions.
@Amanieu Amanieu linked an issue Nov 5, 2021 that may be closed by this pull request
@Amanieu
Copy link
Contributor

Amanieu commented Nov 30, 2021

Closing in favor of #2699

@Amanieu Amanieu closed this Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕵️ needs investigation The issue/PR needs further investigation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[c-api] wasm_instance_new is slow
4 participants