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

c-api: Create RootScope where necessary #8374

Merged
merged 2 commits into from
Apr 15, 2024

Commits on Apr 15, 2024

  1. c-api: Create RootScope where necessary

    This commit changes the `wasmtime_val_t::{from_val, to_val}` methods to
    take a `RootScope` instead of any `AsContextMut`. This then required a
    number of refactorings in callers to ensure that a `RootScope` was
    created for any function that needed one. This is required to ensure
    that GC references in the C API aren't forced to live for the entire
    lifetime of the store.
    
    This additionally added `*_unrooted` variants which do the same thing
    but don't require `RootScope`. This was needed for when the C API calls
    out to the embedder through a function call because a new `RootScope`
    wouldn't work for return values (they're bound to a scope within the
    closure when we want them to outlive the closure). In these situations
    though we know a `RootScope` is already present at the entrypoint.
    
    Closes bytecodealliance#8367
    alexcrichton committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    58ebadf View commit details
    Browse the repository at this point in the history
  2. Review comments

    alexcrichton committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    347c594 View commit details
    Browse the repository at this point in the history