mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-19 03:41:22 +00:00
Update spectests to work with new Instance; use Arc<Mutex<>>
This commit is contained in:
@ -16,7 +16,12 @@ use crate::{
|
||||
vm::{self, InternalField},
|
||||
};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::{mem, pin::Pin, ptr::NonNull, sync::Arc};
|
||||
use std::{
|
||||
mem,
|
||||
pin::Pin,
|
||||
ptr::NonNull,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
pub(crate) struct InstanceInner {
|
||||
#[allow(dead_code)]
|
||||
@ -520,6 +525,27 @@ impl LikeNamespace for Rc<Instance> {
|
||||
}
|
||||
}
|
||||
|
||||
impl LikeNamespace for Arc<Mutex<Instance>> {
|
||||
fn get_export(&self, name: &str) -> Option<Export> {
|
||||
let instance = self.lock().unwrap();
|
||||
let export_index = instance.module.info.exports.get(name)?;
|
||||
|
||||
Some(
|
||||
instance
|
||||
.inner
|
||||
.get_export_from_index(&instance.module, export_index),
|
||||
)
|
||||
}
|
||||
|
||||
fn get_exports(&self) -> Vec<(String, Export)> {
|
||||
unimplemented!("Use the exports method instead");
|
||||
}
|
||||
|
||||
fn maybe_insert(&mut self, _name: &str, _export: Export) -> Option<()> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn call_func_with_index(
|
||||
info: &ModuleInfo,
|
||||
|
Reference in New Issue
Block a user