Update no_std support.
This `no_std` support isn't complete though, as some dependencies don't support it.
This commit is contained in:
@@ -17,11 +17,12 @@ cranelift-wasm = "0.26.0"
|
|||||||
cast = { version = "0.2.2", default-features = false }
|
cast = { version = "0.2.2", default-features = false }
|
||||||
failure = { version = "0.1.3", default-features = false }
|
failure = { version = "0.1.3", default-features = false }
|
||||||
failure_derive = { version = "0.1.3", default-features = false }
|
failure_derive = { version = "0.1.3", default-features = false }
|
||||||
|
hashmap_core = { version = "0.1.9", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
||||||
core = ["cranelift-codegen/core", "cranelift-wasm/core"]
|
core = ["hashmap_core", "cranelift-codegen/core", "cranelift-wasm/core"]
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "experimental" }
|
maintenance = { status = "experimental" }
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use crate::module::{MemoryPlan, MemoryStyle, Module, TableStyle};
|
|||||||
use crate::vmoffsets::VMOffsets;
|
use crate::vmoffsets::VMOffsets;
|
||||||
use crate::WASM_PAGE_SIZE;
|
use crate::WASM_PAGE_SIZE;
|
||||||
use cast;
|
use cast;
|
||||||
|
use core::clone::Clone;
|
||||||
use cranelift_codegen::cursor::FuncCursor;
|
use cranelift_codegen::cursor::FuncCursor;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use cranelift_codegen::ir::condcodes::*;
|
use cranelift_codegen::ir::condcodes::*;
|
||||||
@@ -16,7 +17,6 @@ use cranelift_wasm::{
|
|||||||
self, FuncIndex, GlobalIndex, GlobalVariable, MemoryIndex, SignatureIndex, TableIndex,
|
self, FuncIndex, GlobalIndex, GlobalVariable, MemoryIndex, SignatureIndex, TableIndex,
|
||||||
WasmResult,
|
WasmResult,
|
||||||
};
|
};
|
||||||
use std::clone::Clone;
|
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
/// Compute an `ir::ExternalName` for a given wasm function index.
|
/// Compute an `ir::ExternalName` for a given wasm function index.
|
||||||
|
|||||||
@@ -24,14 +24,23 @@
|
|||||||
clippy::use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![no_std]
|
||||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||||
|
|
||||||
use cranelift_wasm;
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate alloc;
|
extern crate alloc as std;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use hashmap_core::HashMap;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use cast;
|
use cast;
|
||||||
|
use cranelift_wasm;
|
||||||
use failure;
|
use failure;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate failure_derive;
|
extern crate failure_derive;
|
||||||
@@ -63,10 +72,3 @@ pub const WASM_PAGE_SIZE: u32 = 0x10000;
|
|||||||
|
|
||||||
/// The number of pages we can have before we run out of byte index space.
|
/// The number of pages we can have before we run out of byte index space.
|
||||||
pub const WASM_MAX_PAGES: u32 = 0x10000;
|
pub const WASM_MAX_PAGES: u32 = 0x10000;
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
|
||||||
mod std {
|
|
||||||
pub use alloc::{string, vec};
|
|
||||||
pub use core::*;
|
|
||||||
pub use core::{i32, str, u32};
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
//! Data structures for representing decoded wasm modules.
|
//! Data structures for representing decoded wasm modules.
|
||||||
|
|
||||||
|
use super::HashMap;
|
||||||
use crate::tunables::Tunables;
|
use crate::tunables::Tunables;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use cranelift_entity::{EntityRef, PrimaryMap};
|
use cranelift_entity::{EntityRef, PrimaryMap};
|
||||||
@@ -7,7 +8,6 @@ use cranelift_wasm::{
|
|||||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex, Global,
|
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex, Global,
|
||||||
GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
|
GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use crate::func_environ::FuncEnvironment;
|
use crate::func_environ::FuncEnvironment;
|
||||||
use crate::module::{Export, MemoryPlan, Module, TableElements, TablePlan};
|
use crate::module::{Export, MemoryPlan, Module, TableElements, TablePlan};
|
||||||
use crate::tunables::Tunables;
|
use crate::tunables::Tunables;
|
||||||
|
use core::clone::Clone;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use cranelift_codegen::ir::{AbiParam, ArgumentPurpose};
|
use cranelift_codegen::ir::{AbiParam, ArgumentPurpose};
|
||||||
use cranelift_codegen::isa::TargetFrontendConfig;
|
use cranelift_codegen::isa::TargetFrontendConfig;
|
||||||
@@ -9,7 +10,6 @@ use cranelift_wasm::{
|
|||||||
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
||||||
SignatureIndex, Table, TableIndex, WasmResult,
|
SignatureIndex, Table, TableIndex, WasmResult,
|
||||||
};
|
};
|
||||||
use std::clone::Clone;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ wasmtime-runtime = { path = "../runtime" }
|
|||||||
region = "1.0.0"
|
region = "1.0.0"
|
||||||
failure = { version = "0.1.3", default-features = false }
|
failure = { version = "0.1.3", default-features = false }
|
||||||
failure_derive = { version = "0.1.3", default-features = false }
|
failure_derive = { version = "0.1.3", default-features = false }
|
||||||
target-lexicon = "0.2.0"
|
target-lexicon = { version = "0.2.0", default-features = false }
|
||||||
|
hashmap_core = { version = "0.1.9", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
||||||
core = ["cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
|
core = ["hashmap_core", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "experimental" }
|
maintenance = { status = "experimental" }
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
use crate::compiler::Compiler;
|
use crate::compiler::Compiler;
|
||||||
use crate::instantiate::SetupError;
|
use crate::instantiate::SetupError;
|
||||||
|
use core::cmp::max;
|
||||||
|
use core::{fmt, mem, ptr, slice};
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use std::cmp::max;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use std::{fmt, mem, ptr, slice};
|
|
||||||
use wasmtime_runtime::{wasmtime_call_trampoline, Export, Instance};
|
use wasmtime_runtime::{wasmtime_call_trampoline, Export, Instance};
|
||||||
|
|
||||||
/// A runtime value.
|
/// A runtime value.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
//! Memory management for executable code.
|
//! Memory management for executable code.
|
||||||
|
|
||||||
|
use core::{cmp, mem};
|
||||||
use region;
|
use region;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use std::{cmp, mem};
|
|
||||||
use wasmtime_runtime::{Mmap, VMFunctionBody};
|
use wasmtime_runtime::{Mmap, VMFunctionBody};
|
||||||
|
|
||||||
/// Memory manager for executable code.
|
/// Memory manager for executable code.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
//! JIT compilation.
|
//! JIT compilation.
|
||||||
|
|
||||||
|
use super::HashMap;
|
||||||
use crate::code_memory::CodeMemory;
|
use crate::code_memory::CodeMemory;
|
||||||
use crate::instantiate::SetupError;
|
use crate::instantiate::SetupError;
|
||||||
use crate::target_tunables::target_tunables;
|
use crate::target_tunables::target_tunables;
|
||||||
@@ -11,7 +12,6 @@ use cranelift_entity::PrimaryMap;
|
|||||||
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
|
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
|
||||||
use cranelift_wasm::DefinedFuncIndex;
|
use cranelift_wasm::DefinedFuncIndex;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use wasmtime_environ::cranelift;
|
use wasmtime_environ::cranelift;
|
||||||
@@ -95,7 +95,7 @@ impl Compiler {
|
|||||||
signature: &ir::Signature,
|
signature: &ir::Signature,
|
||||||
value_size: usize,
|
value_size: usize,
|
||||||
) -> Result<*const VMFunctionBody, SetupError> {
|
) -> Result<*const VMFunctionBody, SetupError> {
|
||||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
use super::hash_map::Entry::{Occupied, Vacant};
|
||||||
Ok(match self.trampoline_park.entry(callee_address) {
|
Ok(match self.trampoline_park.entry(callee_address) {
|
||||||
Occupied(entry) => *entry.get(),
|
Occupied(entry) => *entry.get(),
|
||||||
Vacant(entry) => {
|
Vacant(entry) => {
|
||||||
|
|||||||
@@ -21,18 +21,26 @@
|
|||||||
clippy::use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![no_std]
|
||||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate alloc as std;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use hashmap_core::{map as hash_map, HashMap};
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use std::collections::{hash_map, HashMap};
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate cranelift_entity;
|
extern crate cranelift_entity;
|
||||||
|
|
||||||
use region;
|
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
|
||||||
#[macro_use]
|
|
||||||
extern crate alloc;
|
|
||||||
use failure;
|
use failure;
|
||||||
|
use region;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate failure_derive;
|
extern crate failure_derive;
|
||||||
@@ -57,10 +65,3 @@ pub use crate::target_tunables::target_tunables;
|
|||||||
// Re-export `Instance` so that users won't need to separately depend on
|
// Re-export `Instance` so that users won't need to separately depend on
|
||||||
// wasmtime-runtime in common cases.
|
// wasmtime-runtime in common cases.
|
||||||
pub use wasmtime_runtime::{Instance, InstantiationError};
|
pub use wasmtime_runtime::{Instance, InstantiationError};
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
|
||||||
mod std {
|
|
||||||
pub use alloc::{boxed, rc, string, vec};
|
|
||||||
pub use core::*;
|
|
||||||
pub use core::{i32, str, u32};
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! Linking for JIT-compiled code.
|
//! Linking for JIT-compiled code.
|
||||||
|
|
||||||
use crate::resolver::Resolver;
|
use crate::resolver::Resolver;
|
||||||
|
use core::ptr::write_unaligned;
|
||||||
use cranelift_codegen::binemit::Reloc;
|
use cranelift_codegen::binemit::Reloc;
|
||||||
use cranelift_entity::PrimaryMap;
|
use cranelift_entity::PrimaryMap;
|
||||||
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
|
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
|
||||||
use std::ptr::write_unaligned;
|
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use wasmtime_environ::{
|
use wasmtime_environ::{
|
||||||
MemoryPlan, MemoryStyle, Module, Relocation, RelocationTarget, Relocations, TablePlan,
|
MemoryPlan, MemoryStyle, Module, Relocation, RelocationTarget, Relocations, TablePlan,
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
//! to exports. This file provides one possible way to manage multiple instances
|
//! to exports. This file provides one possible way to manage multiple instances
|
||||||
//! and resolve imports to exports among them.
|
//! and resolve imports to exports among them.
|
||||||
|
|
||||||
|
use super::HashMap;
|
||||||
use crate::action::{get, inspect_memory, invoke};
|
use crate::action::{get, inspect_memory, invoke};
|
||||||
use crate::action::{ActionError, ActionOutcome, RuntimeValue};
|
use crate::action::{ActionError, ActionOutcome, RuntimeValue};
|
||||||
use crate::compiler::Compiler;
|
use crate::compiler::Compiler;
|
||||||
use crate::resolver::Resolver;
|
use crate::resolver::Resolver;
|
||||||
use cranelift_entity::PrimaryMap;
|
use cranelift_entity::PrimaryMap;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use wasmtime_runtime::{Export, Instance};
|
use wasmtime_runtime::{Export, Instance};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::cmp::min;
|
use core::cmp::min;
|
||||||
use target_lexicon::{OperatingSystem, Triple};
|
use target_lexicon::{OperatingSystem, Triple};
|
||||||
use wasmtime_environ::Tunables;
|
use wasmtime_environ::Tunables;
|
||||||
|
|
||||||
|
|||||||
@@ -13,16 +13,17 @@ use crate::vmcontext::{
|
|||||||
VMGlobalImport, VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition,
|
VMGlobalImport, VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition,
|
||||||
VMTableImport,
|
VMTableImport,
|
||||||
};
|
};
|
||||||
|
use core::slice;
|
||||||
|
use core::{mem, ptr};
|
||||||
use cranelift_entity::EntityRef;
|
use cranelift_entity::EntityRef;
|
||||||
use cranelift_entity::{BoxedSlice, PrimaryMap};
|
use cranelift_entity::{BoxedSlice, PrimaryMap};
|
||||||
use cranelift_wasm::{
|
use cranelift_wasm::{
|
||||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex,
|
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex,
|
||||||
GlobalIndex, GlobalInit, MemoryIndex, SignatureIndex, TableIndex,
|
GlobalIndex, GlobalInit, MemoryIndex, SignatureIndex, TableIndex,
|
||||||
};
|
};
|
||||||
|
use std::borrow::ToOwned;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::slice;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::{mem, ptr};
|
|
||||||
use wasmtime_environ::{DataInitializer, Module, TableElements, VMOffsets};
|
use wasmtime_environ::{DataInitializer, Module, TableElements, VMOffsets};
|
||||||
|
|
||||||
fn signature_id(
|
fn signature_id(
|
||||||
|
|||||||
@@ -21,15 +21,24 @@
|
|||||||
clippy::use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![no_std]
|
||||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate alloc as std;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use hashmap_core::{map as hash_map, HashMap};
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use std::collections::{hash_map, HashMap};
|
||||||
|
|
||||||
use errno;
|
use errno;
|
||||||
use region;
|
use region;
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
|
||||||
#[macro_use]
|
|
||||||
extern crate alloc;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
use libc;
|
use libc;
|
||||||
@@ -66,10 +75,3 @@ pub use crate::vmcontext::{
|
|||||||
VMContext, VMFunctionBody, VMFunctionImport, VMGlobalDefinition, VMGlobalImport,
|
VMContext, VMFunctionBody, VMFunctionImport, VMGlobalDefinition, VMGlobalImport,
|
||||||
VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport,
|
VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
|
||||||
mod std {
|
|
||||||
pub use alloc::{string, vec};
|
|
||||||
pub use core::*;
|
|
||||||
pub use core::{i32, str, u32};
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
//! Low-level abstraction for allocating and managing zero-filled pages
|
//! Low-level abstraction for allocating and managing zero-filled pages
|
||||||
//! of memory.
|
//! of memory.
|
||||||
|
|
||||||
|
use core::ptr;
|
||||||
|
use core::slice;
|
||||||
use errno;
|
use errno;
|
||||||
use libc;
|
use libc;
|
||||||
use region;
|
use region;
|
||||||
use std::ptr;
|
use std::string::{String, ToString};
|
||||||
use std::slice;
|
use std::vec::Vec;
|
||||||
use std::string::String;
|
|
||||||
|
|
||||||
/// Round `size` up to the nearest multiple of `page_size`.
|
/// Round `size` up to the nearest multiple of `page_size`.
|
||||||
fn round_up_to_page_size(size: usize, page_size: usize) -> usize {
|
fn round_up_to_page_size(size: usize, page_size: usize) -> usize {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! Implement a registry of function signatures, for fast indirect call
|
//! Implement a registry of function signatures, for fast indirect call
|
||||||
//! signature checking.
|
//! signature checking.
|
||||||
|
|
||||||
|
use super::{hash_map, HashMap};
|
||||||
use crate::vmcontext::VMSharedSignatureIndex;
|
use crate::vmcontext::VMSharedSignatureIndex;
|
||||||
use cast;
|
use cast;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use std::collections::{hash_map, HashMap};
|
|
||||||
|
|
||||||
/// WebAssembly requires that the caller and callee signatures in an indirect
|
/// WebAssembly requires that the caller and callee signatures in an indirect
|
||||||
/// call must match. To implement this efficiently, keep a registry of all
|
/// call must match. To implement this efficiently, keep a registry of all
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use crate::vmcontext::VMContext;
|
use crate::vmcontext::VMContext;
|
||||||
use std::borrow::{Borrow, BorrowMut};
|
use core::borrow::{Borrow, BorrowMut};
|
||||||
use std::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/signalhandlers.rs"));
|
include!(concat!(env!("OUT_DIR"), "/signalhandlers.rs"));
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use crate::vmcontext::{VMCallerCheckedAnyfunc, VMTableDefinition};
|
use crate::vmcontext::{VMCallerCheckedAnyfunc, VMTableDefinition};
|
||||||
use cranelift_wasm::TableElementType;
|
use cranelift_wasm::TableElementType;
|
||||||
|
use std::vec::Vec;
|
||||||
use wasmtime_environ::{TablePlan, TableStyle};
|
use wasmtime_environ::{TablePlan, TableStyle};
|
||||||
|
|
||||||
/// A table instance.
|
/// A table instance.
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
use crate::signalhandlers::jmp_buf;
|
use crate::signalhandlers::jmp_buf;
|
||||||
use crate::vmcontext::{VMContext, VMFunctionBody};
|
use crate::vmcontext::{VMContext, VMFunctionBody};
|
||||||
|
use core::cell::{Cell, RefCell};
|
||||||
|
use core::mem;
|
||||||
|
use core::ptr;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::cell::{Cell, RefCell};
|
|
||||||
use std::mem;
|
|
||||||
use std::ptr;
|
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
// Currently we uset setjmp/longjmp to unwind out of a signal handler
|
// Currently we uset setjmp/longjmp to unwind out of a signal handler
|
||||||
// and back to the point where WebAssembly was called (via `call_wasm`).
|
// and back to the point where WebAssembly was called (via `call_wasm`).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//! fields that compiled wasm code accesses directly.
|
//! fields that compiled wasm code accesses directly.
|
||||||
|
|
||||||
use crate::instance::InstanceContents;
|
use crate::instance::InstanceContents;
|
||||||
use std::{ptr, u32};
|
use core::{ptr, u32};
|
||||||
|
|
||||||
/// An imported function.
|
/// An imported function.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
@@ -18,7 +18,7 @@ pub struct VMFunctionImport {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmfunction_import {
|
mod test_vmfunction_import {
|
||||||
use super::VMFunctionImport;
|
use super::VMFunctionImport;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -50,7 +50,7 @@ pub struct VMFunctionBody(u8);
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmfunction_body {
|
mod test_vmfunction_body {
|
||||||
use super::VMFunctionBody;
|
use super::VMFunctionBody;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_vmfunction_body_offsets() {
|
fn check_vmfunction_body_offsets() {
|
||||||
@@ -73,7 +73,7 @@ pub struct VMTableImport {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmtable_import {
|
mod test_vmtable_import {
|
||||||
use super::VMTableImport;
|
use super::VMTableImport;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -110,7 +110,7 @@ pub struct VMMemoryImport {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmmemory_import {
|
mod test_vmmemory_import {
|
||||||
use super::VMMemoryImport;
|
use super::VMMemoryImport;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -144,7 +144,7 @@ pub struct VMGlobalImport {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmglobal_import {
|
mod test_vmglobal_import {
|
||||||
use super::VMGlobalImport;
|
use super::VMGlobalImport;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -178,7 +178,7 @@ pub struct VMMemoryDefinition {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmmemory_definition {
|
mod test_vmmemory_definition {
|
||||||
use super::VMMemoryDefinition;
|
use super::VMMemoryDefinition;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -221,7 +221,7 @@ pub struct VMTableDefinition {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmtable_definition {
|
mod test_vmtable_definition {
|
||||||
use super::VMTableDefinition;
|
use super::VMTableDefinition;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -257,7 +257,7 @@ pub struct VMGlobalDefinition {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmglobal_definition {
|
mod test_vmglobal_definition {
|
||||||
use super::VMGlobalDefinition;
|
use super::VMGlobalDefinition;
|
||||||
use std::mem::{align_of, size_of};
|
use core::mem::{align_of, size_of};
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -391,7 +391,7 @@ pub struct VMSharedSignatureIndex(u32);
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmshared_signature_index {
|
mod test_vmshared_signature_index {
|
||||||
use super::VMSharedSignatureIndex;
|
use super::VMSharedSignatureIndex;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -427,7 +427,7 @@ pub struct VMCallerCheckedAnyfunc {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vmcaller_checked_anyfunc {
|
mod test_vmcaller_checked_anyfunc {
|
||||||
use super::VMCallerCheckedAnyfunc;
|
use super::VMCallerCheckedAnyfunc;
|
||||||
use std::mem::size_of;
|
use core::mem::size_of;
|
||||||
use wasmtime_environ::{Module, VMOffsets};
|
use wasmtime_environ::{Module, VMOffsets};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user