From f02a356b6b31dfa5a8b6d87fefd2bf5a5fc2a41b Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 15 Apr 2019 17:15:48 +0200 Subject: [PATCH] WIP --- Cargo.toml | 3 +++ src/common/mod.rs | 8 -------- src/lib.rs | 1 - validation/Cargo.toml | 12 ++++++++++++ validation/src/lib.rs | 17 +++++++++++++++++ {src/common => validation/src}/stack.rs | 0 6 files changed, 32 insertions(+), 9 deletions(-) delete mode 100644 src/common/mod.rs create mode 100644 validation/Cargo.toml create mode 100644 validation/src/lib.rs rename {src/common => validation/src}/stack.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index bb06203..ac9dd7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,3 +28,6 @@ libm = { version = "0.1.2", optional = true } assert_matches = "1.1" rand = "0.4.2" wabt = "0.6" + +[workspace] +members = ["validation"] diff --git a/src/common/mod.rs b/src/common/mod.rs deleted file mode 100644 index 6fdb382..0000000 --- a/src/common/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub mod stack; - -/// Index of default linear memory. -pub const DEFAULT_MEMORY_INDEX: u32 = 0; -/// Index of default table. -pub const DEFAULT_TABLE_INDEX: u32 = 0; - -// TODO: Move BlockFrame under validation. diff --git a/src/lib.rs b/src/lib.rs index 1411a17..badcfb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -380,7 +380,6 @@ impl From for Error { } } -mod common; mod func; mod global; mod host; diff --git a/validation/Cargo.toml b/validation/Cargo.toml new file mode 100644 index 0000000..ae956da --- /dev/null +++ b/validation/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "wasmi-validation" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +parity-wasm = { version = "0.31", default-features = false } + +[features] +default = ["std"] +std = ["parity-wasm/std"] diff --git a/validation/src/lib.rs b/validation/src/lib.rs new file mode 100644 index 0000000..a427d7b --- /dev/null +++ b/validation/src/lib.rs @@ -0,0 +1,17 @@ +#![warn(missing_docs)] +#![cfg_attr(not(feature = "std"), no_std)] +//// alloc is required in no_std +#![cfg_attr(not(feature = "std"), feature(alloc))] + +#[cfg(not(feature = "std"))] +#[macro_use] +extern crate alloc; +#[cfg(feature = "std")] +extern crate std as alloc; + +pub mod stack; + +/// Index of default linear memory. +pub const DEFAULT_MEMORY_INDEX: u32 = 0; +/// Index of default table. +pub const DEFAULT_TABLE_INDEX: u32 = 0; diff --git a/src/common/stack.rs b/validation/src/stack.rs similarity index 100% rename from src/common/stack.rs rename to validation/src/stack.rs