Reimplement how instance exports are stored/loaded (#2984)

* Reimplement how instance exports are stored/loaded

This commit internally refactors how instance exports are handled and
fixes two issues. One issue is that when we instantiate an instance we
no longer forcibly load all items from the instance immediately,
deferring insertion of each item into the store data tables to happen
later as necessary. The next issue is that repeated calls to
`Caller::get_export` would continuously insert items into the store data
tables. While working as intended this was undesirable because it would
continuously push onto a vector that only got deallocated once the
entire store was deallocate. Now it's routed to `Instance::get_export`
which doesn't have this behavior.

Closes #2916
Closes #2983

* Just define our own `Either`
This commit is contained in:
Alex Crichton
2021-06-17 14:27:48 -05:00
committed by GitHub
parent 5ddf562309
commit d8d4bf81b2
8 changed files with 372 additions and 165 deletions

View File

@@ -143,7 +143,7 @@ impl Instance {
.cast()
}
pub(crate) fn module(&self) -> &Module {
pub(crate) fn module(&self) -> &Arc<Module> {
&self.module
}
@@ -957,7 +957,7 @@ impl InstanceHandle {
}
/// Return a reference to a module.
pub fn module(&self) -> &Module {
pub fn module(&self) -> &Arc<Module> {
self.instance().module()
}