Optimized ModuleInfo usage

This commit is contained in:
Syrus Akbary
2023-02-16 20:44:49 -08:00
parent c85b2bf62e
commit db6dd420e1
9 changed files with 57 additions and 29 deletions

View File

@@ -4,6 +4,7 @@ use crate::{Features, MemoryIndex, MemoryStyle, ModuleInfo, TableIndex, TableSty
use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
use std::sync::Arc;
/// The required info for compiling a module.
///
@@ -16,7 +17,7 @@ pub struct CompileModuleInfo {
/// The features used for compiling the module
pub features: Features,
/// The module information
pub module: ModuleInfo,
pub module: Arc<ModuleInfo>,
/// The memory styles used for compiling.
///
/// The compiler will emit the most optimal code based

View File

@@ -128,7 +128,12 @@ impl SerializableModule {
/// Create a `ModuleInfo` for instantiation
pub fn create_module_info(&self) -> ModuleInfo {
self.compile_info.module.clone()
self.compile_info.module.as_ref().clone()
}
/// Returns the `ModuleInfo` for instantiation
pub fn module_info(&self) -> &ModuleInfo {
&self.compile_info.module
}
/// Returns the features for this Artifact