Begin work on no_std support.
This adds no_std support to a bunch of things, but more work is needed.
This commit is contained in:
@@ -7,6 +7,7 @@ description = "JIT-style execution for WebAsssembly code in Cranelift"
|
||||
categories = ["wasm"]
|
||||
repository = "https://github.com/CraneStation/wasmtime"
|
||||
license = "Apache-2.0 WITH LLVM-exception"
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = "0.24.0"
|
||||
@@ -15,3 +16,12 @@ cranelift-wasm = "0.24.0"
|
||||
region = "1.0.0"
|
||||
wasmtime-environ = { path = "../environ" }
|
||||
memmap = "0.7.0"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
||||
core = ["cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "experimental" }
|
||||
travis-ci = { repository = "CraneStation/wasmtime" }
|
||||
|
||||
4
lib/execute/README.md
Normal file
4
lib/execute/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
This is the `wasmtime-execute` crate, which contains wasm runtime support,
|
||||
supporting the wasm ABI defined by [`wasmtime-environ`].
|
||||
|
||||
[`wasmtime-environ`]: https://crates.io/crates/wasmtime-environ
|
||||
@@ -8,6 +8,8 @@ use region::protect;
|
||||
use region::Protection;
|
||||
use std::mem::transmute;
|
||||
use std::ptr::{self, write_unaligned};
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
use wasmtime_environ::{
|
||||
compile_module, Compilation, Module, ModuleTranslation, Relocation, RelocationTarget,
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ use cranelift_entity::EntityRef;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use cranelift_wasm::{GlobalIndex, MemoryIndex, TableIndex};
|
||||
use memory::LinearMemory;
|
||||
use std::vec::Vec;
|
||||
use wasmtime_environ::{Compilation, DataInitializer, Module, TableElements};
|
||||
|
||||
/// An Instance of a WebAssemby module.
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
//! JIT-style runtime for WebAssembly using Cranelift.
|
||||
|
||||
#![deny(
|
||||
missing_docs,
|
||||
trivial_numeric_casts,
|
||||
unused_extern_crates,
|
||||
unstable_features
|
||||
)]
|
||||
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
|
||||
#![warn(unused_import_braces)]
|
||||
#![cfg_attr(feature = "std", deny(unstable_features))]
|
||||
#![cfg_attr(
|
||||
feature = "clippy",
|
||||
plugin(clippy(conf_file = "../../clippy.toml"))
|
||||
@@ -28,6 +24,8 @@
|
||||
use_self
|
||||
)
|
||||
)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
|
||||
extern crate cranelift_codegen;
|
||||
extern crate cranelift_entity;
|
||||
@@ -35,6 +33,9 @@ extern crate cranelift_wasm;
|
||||
extern crate memmap;
|
||||
extern crate region;
|
||||
extern crate wasmtime_environ;
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
mod execute;
|
||||
mod instance;
|
||||
@@ -42,3 +43,10 @@ mod memory;
|
||||
|
||||
pub use execute::{compile_and_link_module, execute};
|
||||
pub use instance::Instance;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod std {
|
||||
pub use alloc::{string, vec};
|
||||
pub use core::*;
|
||||
pub use core::{i32, str, u32};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user