Skip to content

Commit

Permalink
Rewrite some use statements
Browse files Browse the repository at this point in the history
Smaller diff, and more sensible that way.
  • Loading branch information
theduke committed Dec 15, 2022
1 parent 006fd49 commit db45dc6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion lib/api/src/sys/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::sys::store::{AsStoreMut, AsStoreRef};
use crate::sys::value::Value;
use crate::sys::GlobalType;
use crate::sys::Mutability;
#[cfg(feature = "compiler")]
use crate::sys::RuntimeError;
use wasmer_vm::{InternalStoreHandle, StoreHandle, VMExtern, VMGlobal};

Expand Down
4 changes: 1 addition & 3 deletions lib/api/src/sys/externals/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use std::slice;
#[cfg(feature = "tracing")]
use tracing::warn;
use wasmer_types::Pages;
#[cfg(feature = "compiler")]
use wasmer_types::WASM_PAGE_SIZE;
use wasmer_vm::{InternalStoreHandle, LinearMemory, MemoryError, StoreHandle, VMExtern, VMMemory};

use super::MemoryView;
Expand Down Expand Up @@ -151,7 +149,7 @@ impl Memory {
let new_view_size = new_view.data_size() as usize;
if amount > new_view_size {
let delta = amount - new_view_size;
let pages = ((delta - 1) / WASM_PAGE_SIZE) + 1;
let pages = ((delta - 1) / wasmer_types::WASM_PAGE_SIZE) + 1;
new_memory.grow(new_store, Pages(pages as u32))?;
new_view = new_memory.view(&new_store);
}
Expand Down
1 change: 0 additions & 1 deletion lib/api/src/sys/externals/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::sys::externals::Extern;
use crate::sys::store::{AsStoreMut, AsStoreRef};
use crate::sys::TableType;
use crate::Value;
#[cfg(feature = "compiler")]
use crate::{sys::RuntimeError, ExternRef, Function};
use wasmer_vm::{InternalStoreHandle, StoreHandle, TableElement, VMExtern, VMTable};

Expand Down
6 changes: 2 additions & 4 deletions lib/api/src/sys/imports.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! The import module contains the implementation data structures and helper functions used to
//! manipulate and access a wasm module's imports including memories, tables, globals, and
//! functions.
#[cfg(feature = "compiler")]
use crate::{AsStoreMut, Memory};
use crate::{Exports, Extern, Module};
use std::collections::HashMap;
use std::fmt;
Expand Down Expand Up @@ -131,7 +129,7 @@ impl Imports {
pub fn import_shared_memory(
&mut self,
module: &Module,
store: &mut impl AsStoreMut,
store: &mut impl crate::AsStoreMut,
) -> Option<VMSharedMemory> {
// Determine if shared memory needs to be created and imported
let shared_memory = module
Expand All @@ -148,7 +146,7 @@ impl Imports {
self.define(
"env",
"memory",
Memory::new_from_existing(store, memory.clone().into()),
crate::Memory::new_from_existing(store, memory.clone().into()),
);
Some(memory)
} else {
Expand Down
1 change: 0 additions & 1 deletion lib/api/src/sys/instance.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::sys::exports::Exports;
use crate::sys::module::Module;
#[cfg(feature = "compiler")]
use crate::sys::{LinkError, RuntimeError};
use std::fmt;
use thiserror::Error;
Expand Down
4 changes: 1 addition & 3 deletions lib/api/src/sys/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use wasmer_vm::{VMExternRef, VMFuncRef};
use crate::ExternRef;
use crate::Function;

#[cfg(feature = "compiler")]
use super::store::AsStoreMut;
use super::store::AsStoreRef;

pub use wasmer_types::RawValue;
Expand Down Expand Up @@ -113,7 +111,7 @@ impl Value {
///
/// # Safety
///
pub unsafe fn from_raw(store: &mut impl AsStoreMut, ty: Type, raw: RawValue) -> Self {
pub unsafe fn from_raw(store: &mut impl crate::AsStoreMut, ty: Type, raw: RawValue) -> Self {
match ty {
Type::I32 => Self::I32(raw.i32),
Type::I64 => Self::I64(raw.i64),
Expand Down

0 comments on commit db45dc6

Please sign in to comment.