Make more code work with no_std. (#407)
* Make more code work with no_std. no_std support is still incomplete, but this patch takes care of the bulk of the straightforward parts.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
//! Memory management for executable code.
|
||||
// Copy of wasmtime's wasmtime-jit/src/code_memory.rs
|
||||
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
use core::{cmp, mem};
|
||||
use region;
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
use wasmtime_runtime::{Mmap, VMFunctionBody};
|
||||
|
||||
/// Memory manager for executable code.
|
||||
|
||||
@@ -7,10 +7,13 @@ use failure::Error;
|
||||
use wasmtime_environ::Module;
|
||||
use wasmtime_runtime::{Imports, InstanceHandle, VMFunctionBody};
|
||||
|
||||
use std::any::Any;
|
||||
use std::cell::{RefCell, RefMut};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
use crate::{HashMap, HashSet};
|
||||
use alloc::boxed::Box;
|
||||
use alloc::rc::Rc;
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
use core::any::Any;
|
||||
use core::cell::{RefCell, RefMut};
|
||||
|
||||
use crate::runtime::Store;
|
||||
|
||||
|
||||
@@ -14,8 +14,11 @@ use failure::Error;
|
||||
use wasmtime_environ::{Export, Module};
|
||||
use wasmtime_runtime::{InstanceHandle, VMContext, VMFunctionBody};
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use alloc::rc::Rc;
|
||||
use alloc::string::ToString;
|
||||
use alloc::vec::Vec;
|
||||
use core::cmp;
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::{Callable, FuncType, Store, Trap, Val};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use alloc::boxed::Box;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use failure::Error;
|
||||
use wasmtime_environ::Module;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::ToString;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use failure::Error;
|
||||
use wasmtime_environ::Module;
|
||||
@@ -13,7 +15,7 @@ pub fn create_handle_with_memory(memory: &MemoryType) -> Result<InstanceHandle,
|
||||
|
||||
let memory = cranelift_wasm::Memory {
|
||||
minimum: memory.limits().min(),
|
||||
maximum: if memory.limits().max() == std::u32::MAX {
|
||||
maximum: if memory.limits().max() == core::u32::MAX {
|
||||
None
|
||||
} else {
|
||||
Some(memory.limits().max())
|
||||
|
||||
@@ -8,8 +8,8 @@ mod memory;
|
||||
mod table;
|
||||
|
||||
use crate::r#ref::HostRef;
|
||||
use alloc::rc::Rc;
|
||||
use failure::Error;
|
||||
use std::rc::Rc;
|
||||
|
||||
use self::func::create_handle_with_function;
|
||||
use self::global::create_global;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::ToString;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use cranelift_wasm::TableElementType;
|
||||
use failure::Error;
|
||||
@@ -12,7 +14,7 @@ pub fn create_handle_with_table(table: &TableType) -> Result<InstanceHandle, Err
|
||||
|
||||
let table = cranelift_wasm::Table {
|
||||
minimum: table.limits().min(),
|
||||
maximum: if table.limits().max() == std::u32::MAX {
|
||||
maximum: if table.limits().max() == core::u32::MAX {
|
||||
None
|
||||
} else {
|
||||
Some(table.limits().max())
|
||||
|
||||
Reference in New Issue
Block a user