Skip to content

Commit

Permalink
Fixed unallocated libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed May 1, 2021
1 parent a7367ea commit 7e7b930
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
7 changes: 5 additions & 2 deletions lib/engine-native/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ pub struct NativeArtifact {
finished_dynamic_function_trampolines: BoxedSlice<FunctionIndex, FunctionBodyPtr>,
func_data_registry: Arc<FuncDataRegistry>,
signatures: BoxedSlice<SignatureIndex, VMSharedSignatureIndex>,
#[allow(dead_code)]
#[loupe(skip)]
library: Option<Library>,
}

fn to_compile_error(err: impl Error) -> CompileError {
Expand Down Expand Up @@ -371,6 +374,7 @@ impl NativeArtifact {
.into_boxed_slice(),
func_data_registry: Arc::new(FuncDataRegistry::new()),
signatures: signatures.into_boxed_slice(),
library: None,
})
}

Expand Down Expand Up @@ -463,11 +467,10 @@ impl NativeArtifact {
.collect::<PrimaryMap<_, _>>()
};

engine_inner.add_library(lib);

Ok(Self {
sharedobject_path,
metadata,
library: Some(lib),
finished_functions: finished_functions.into_boxed_slice(),
finished_function_call_trampolines: finished_function_call_trampolines
.into_boxed_slice(),
Expand Down
11 changes: 0 additions & 11 deletions lib/engine-native/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Native Engine.
use crate::NativeArtifact;
use libloading::Library;
use loupe::MemoryUsage;
use std::path::Path;
use std::sync::Arc;
Expand Down Expand Up @@ -42,7 +41,6 @@ impl NativeEngine {
features,
is_cross_compiling,
linker,
libraries: vec![],
})),
target: Arc::new(target),
engine_id: EngineId::default(),
Expand Down Expand Up @@ -74,7 +72,6 @@ impl NativeEngine {
prefixer: None,
is_cross_compiling: false,
linker: Linker::None,
libraries: vec![],
})),
target: Arc::new(Target::default()),
engine_id: EngineId::default(),
Expand Down Expand Up @@ -259,10 +256,6 @@ pub struct NativeEngineInner {

/// The linker to use.
linker: Linker,

/// List of libraries loaded by this engine.
#[loupe(skip)]
libraries: Vec<Library>,
}

impl NativeEngineInner {
Expand Down Expand Up @@ -323,8 +316,4 @@ impl NativeEngineInner {
pub(crate) fn linker(&self) -> Linker {
self.linker
}

pub(crate) fn add_library(&mut self, library: Library) {
self.libraries.push(library);
}
}

0 comments on commit 7e7b930

Please sign in to comment.