Skip to content

Commit

Permalink
Revert "Fixed unallocated libraries"
Browse files Browse the repository at this point in the history
This reverts commit 7e7b930.
  • Loading branch information
syrusakbary committed May 1, 2021
1 parent 8fae8ae commit 1b3fa61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/engine-native/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ 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 @@ -374,7 +371,6 @@ impl NativeArtifact {
.into_boxed_slice(),
func_data_registry: Arc::new(FuncDataRegistry::new()),
signatures: signatures.into_boxed_slice(),
library: None,
})
}

Expand Down Expand Up @@ -467,10 +463,11 @@ 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: 11 additions & 0 deletions lib/engine-native/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Native Engine.
use crate::NativeArtifact;
use libloading::Library;
use loupe::MemoryUsage;
use std::path::Path;
use std::sync::Arc;
Expand Down Expand Up @@ -41,6 +42,7 @@ impl NativeEngine {
features,
is_cross_compiling,
linker,
libraries: vec![],
})),
target: Arc::new(target),
engine_id: EngineId::default(),
Expand Down Expand Up @@ -72,6 +74,7 @@ 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 @@ -256,6 +259,10 @@ 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 @@ -316,4 +323,8 @@ 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 1b3fa61

Please sign in to comment.