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

feat(runtime-c-api) Add an API to update vm::Ctx.data #261

Merged
merged 7 commits into from
Mar 12, 2019

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Mar 11, 2019

This patch adds 2 functions for the runtime C API, respectively
wasmer_instance_context_data_set and
wasmer_instance_context_data_get. The goal is to modify the
vm::Ctx.data field in the runtime-core library.

Since all imported functions receive this context, that's the
simplest way to pass dynamic data to them.

This patch adds 2 functions for the runtime C API, respectively
`wasmer_instance_context_data_set` and
`wasmer_instance_context_data_get`. The goal is to modify the
`vm::Ctx.data` field in the `runtime-core` library.

This is required to pass dynamic data to imported functions for
instance.
@Hywan Hywan added 🎉 enhancement New feature! 📦 lib-c-api About wasmer-c-api labels Mar 11, 2019
@Hywan Hywan requested a review from bjfish March 11, 2019 15:57
@bjfish
Copy link
Contributor

bjfish commented Mar 11, 2019

This looks good. Could you please add calling these functions to one of the C tests and assert the get matches what is set?

@Hywan
Copy link
Contributor Author

Hywan commented Mar 11, 2019

Sure!

@Hywan
Copy link
Contributor Author

Hywan commented Mar 11, 2019

bors r+

bors bot added a commit that referenced this pull request Mar 11, 2019
261: feat(runtime-c-api) Add an API to update `vm::Ctx.data` r=Hywan a=Hywan

This patch adds 2 functions for the runtime C API, respectively
`wasmer_instance_context_data_set` and
`wasmer_instance_context_data_get`. The goal is to modify the
`vm::Ctx.data` field in the `runtime-core` library.

Since all imported functions receive this context, that's the
simplest way to pass dynamic data to them.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
@bors
Copy link
Contributor

bors bot commented Mar 11, 2019

Build failed

@Hywan
Copy link
Contributor Author

Hywan commented Mar 12, 2019

bors retry

bors bot added a commit that referenced this pull request Mar 12, 2019
261: feat(runtime-c-api) Add an API to update `vm::Ctx.data` r=Hywan a=Hywan

This patch adds 2 functions for the runtime C API, respectively
`wasmer_instance_context_data_set` and
`wasmer_instance_context_data_get`. The goal is to modify the
`vm::Ctx.data` field in the `runtime-core` library.

Since all imported functions receive this context, that's the
simplest way to pass dynamic data to them.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
@bors
Copy link
Contributor

bors bot commented Mar 12, 2019

Build failed

@Hywan
Copy link
Contributor Author

Hywan commented Mar 12, 2019

bors retry

bors bot added a commit that referenced this pull request Mar 12, 2019
261: feat(runtime-c-api) Add an API to update `vm::Ctx.data` r=Hywan a=Hywan

This patch adds 2 functions for the runtime C API, respectively
`wasmer_instance_context_data_set` and
`wasmer_instance_context_data_get`. The goal is to modify the
`vm::Ctx.data` field in the `runtime-core` library.

Since all imported functions receive this context, that's the
simplest way to pass dynamic data to them.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
@bors
Copy link
Contributor

bors bot commented Mar 12, 2019

@bors bors bot merged commit 5db05fd into wasmerio:master Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-c-api About wasmer-c-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants