Stream: git-wasmtime

Topic: wasmtime / issue #11317 Create a `DefinedInstance` intern...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 24 2025 at 17:09):

fitzgen opened issue #11317:

A DefinedInstance is exactly like Instance but it only provides access to defined tables/memories/globals/etc...

This would allow us to make splitting a mutable store borrow into multiple mutable (defined!) instance borrows safe because you couldn't access the imported entities that could alias defined items from another instance that could also be mutably borrowed. That is, this method (and any others we might eventually add like it) would no longer need to be unsafe as long as it yielded DefinedInstances instead of Instances:

https://github.com/bytecodealliance/wasmtime/blob/eb54a90ece02e4ac5a26e81809944496f6e65604/crates/wasmtime/src/runtime/store.rs#L1308-L1332

To cut down on code duplication, we would probably want an Instance to deref to a DefinedInstance or something like that. Probably Instance would be a newtype of DefinedInstance that has methods for accessing imported items and anything that accesses that stuff, and then it also derefs to its inner DefinedInstance.

cc @alexcrichton

view this post on Zulip Wasmtime GitHub notifications bot (Jul 24 2025 at 17:09):

fitzgen added the wasmtime:unsafe-code label to Issue #11317.


Last updated: Dec 06 2025 at 07:03 UTC