Skip to content

Commit

Permalink
rn module_ref()
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed May 26, 2020
1 parent d47371f commit c9da8fb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/jit/src/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl CompiledModule {
}

/// Return a reference to a module.
pub fn module_ref(&self) -> &Module {
pub fn module(&self) -> &Module {
&self.module
}

Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/src/debug_builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub unsafe extern "C" fn resolve_vmctx_memory_ptr(p: *const u32) -> *const u8 {
);
let handle = InstanceHandle::from_vmctx(VMCTX_AND_MEMORY.0);
assert!(
VMCTX_AND_MEMORY.1 < handle.module_ref().local.memory_plans.len(),
VMCTX_AND_MEMORY.1 < handle.module().local.memory_plans.len(),
"memory index for debugger is out of bounds"
);
let index = MemoryIndex::new(VMCTX_AND_MEMORY.1);
Expand Down
6 changes: 3 additions & 3 deletions crates/runtime/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Instance {
unsafe { *self.signature_ids_ptr().add(index) }
}

pub(crate) fn module_ref(&self) -> &Module {
pub(crate) fn module(&self) -> &Module {
&self.module
}

Expand Down Expand Up @@ -934,8 +934,8 @@ impl InstanceHandle {
}

/// Return a reference to a module.
pub fn module_ref(&self) -> &Module {
self.instance().module_ref()
pub fn module(&self) -> &Module {
self.instance().module()
}

/// Lookup an export with the given name.
Expand Down
6 changes: 3 additions & 3 deletions crates/wasmtime/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ fn instantiate(
}
}

if imports.len() != compiled_module.module_ref().imports.len() {
if imports.len() != compiled_module.module().imports.len() {
bail!(
"wrong number of imports provided, {} != {}",
imports.len(),
compiled_module.module_ref().imports.len()
compiled_module.module().imports.len()
);
}

Expand Down Expand Up @@ -79,7 +79,7 @@ fn instantiate(
instance
};

let start_func = instance.handle.module_ref().start_func;
let start_func = instance.handle.module().start_func;

// If a start function is present, invoke it. Make sure we use all the
// trap-handling configuration in `store` as well.
Expand Down
6 changes: 3 additions & 3 deletions crates/wasmtime/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl Module {
pub fn imports<'module>(
&'module self,
) -> impl ExactSizeIterator<Item = ImportType<'module>> + 'module {
let module = self.inner.compiled.module_ref();
let module = self.inner.compiled.module();
module
.imports
.iter()
Expand Down Expand Up @@ -484,7 +484,7 @@ impl Module {
pub fn exports<'module>(
&'module self,
) -> impl ExactSizeIterator<Item = ExportType<'module>> + 'module {
let module = self.inner.compiled.module_ref();
let module = self.inner.compiled.module();
module.exports.iter().map(move |(name, entity_index)| {
let r#type = EntityType::new(entity_index, module);
ExportType::new(name, r#type)
Expand Down Expand Up @@ -535,7 +535,7 @@ impl Module {
/// # }
/// ```
pub fn get_export<'module>(&'module self, name: &'module str) -> Option<ExternType> {
let module = self.inner.compiled.module_ref();
let module = self.inner.compiled.module();
let entity_index = module.exports.get(name)?;
Some(EntityType::new(entity_index, module).extern_type())
}
Expand Down

0 comments on commit c9da8fb

Please sign in to comment.