mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-18 06:19:12 +00:00
Impl Clone for EngineId. EngineId distinguishes between clone() calls, so it returns a new ID when cloned.
This commit is contained in:
@@ -16,22 +16,13 @@ use wasmer_runtime::{
|
||||
};
|
||||
|
||||
/// A WebAssembly `JIT` Engine.
|
||||
#[derive(Clone)]
|
||||
pub struct JITEngine {
|
||||
inner: Arc<Mutex<JITEngineInner>>,
|
||||
tunables: Arc<dyn Tunables + Send + Sync>,
|
||||
engine_id: EngineId,
|
||||
}
|
||||
|
||||
impl Clone for JITEngine {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
inner: self.inner.clone(),
|
||||
tunables: self.tunables.clone(),
|
||||
engine_id: EngineId::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl JITEngine {
|
||||
/// Create a new `JITEngine` with the given config
|
||||
#[cfg(feature = "compiler")]
|
||||
|
||||
@@ -13,22 +13,13 @@ use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables};
|
||||
use wasmer_runtime::{SignatureRegistry, VMSharedSignatureIndex, VMTrampoline};
|
||||
|
||||
/// A WebAssembly `Native` Engine.
|
||||
#[derive(Clone)]
|
||||
pub struct NativeEngine {
|
||||
inner: Arc<Mutex<NativeEngineInner>>,
|
||||
tunables: Arc<dyn Tunables + Send + Sync>,
|
||||
engine_id: EngineId,
|
||||
}
|
||||
|
||||
impl Clone for NativeEngine {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
inner: self.inner.clone(),
|
||||
tunables: self.tunables.clone(),
|
||||
engine_id: EngineId::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NativeEngine {
|
||||
/// Create a new `NativeEngine` with the given config
|
||||
#[cfg(feature = "compiler")]
|
||||
|
||||
@@ -67,6 +67,12 @@ impl EngineId {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for EngineId {
|
||||
fn clone(&self) -> Self {
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for EngineId {
|
||||
fn default() -> Self {
|
||||
static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
@@ -18,6 +18,7 @@ extern "C" fn dummy_trampoline(
|
||||
}
|
||||
|
||||
/// A WebAssembly `Dummy` Engine.
|
||||
#[derive(Clone)]
|
||||
pub struct DummyEngine {
|
||||
signatures: Arc<SignatureRegistry>,
|
||||
features: Arc<Features>,
|
||||
@@ -25,17 +26,6 @@ pub struct DummyEngine {
|
||||
engine_id: EngineId,
|
||||
}
|
||||
|
||||
impl Clone for DummyEngine {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
signatures: self.signatures.clone(),
|
||||
features: self.features.clone(),
|
||||
tunables: self.tunables.clone(),
|
||||
engine_id: EngineId::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DummyEngine {
|
||||
#[cfg(feature = "compiler")]
|
||||
pub fn new(tunables: impl Tunables + 'static + Send + Sync) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user