Many renames.

- Everything polkadot becomes polkadot-.
- Wasm (substrate) executor tests split from Wasm (Polkadot) runtime and
built independently.
This commit is contained in:
Gav
2018-02-07 23:36:34 +01:00
parent 3d0a44c8a9
commit 5c842f77bc
453 changed files with 3230 additions and 90 deletions
+23
View File
@@ -0,0 +1,23 @@
[package]
name = "pwasm-alloc"
version = "0.1.0"
authors = ["Nikolay Volf <nikvolf@gmail.com>"]
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/paritytech/pwasm-std"
homepage = "https://github.com/paritytech/pwasm-std"
documentation = "https://paritytech.github.io/pwasm-std/pwasm_std/"
description = "Parity WebAssembly standard library internal allocator"
keywords = ["wasm", "parity", "webassembly", "blockchain"]
categories = ["no-std", "embedded"]
build = "build.rs"
[dependencies]
pwasm-libc = { path = "../pwasm-libc", version = "0.1" }
[build-dependencies]
rustc_version = "0.2"
[features]
strict = []
nightly = []
+12
View File
@@ -0,0 +1,12 @@
# pwasm-libc
Parity WASM contracts standard library libc bindings
[Documentation](https://paritytech.github.io/pwasm-std/pwasm_alloc/)
# License
`pwasm_alloc` is primarily distributed under the terms of both the MIT
license and the Apache License (Version 2.0), at your choice.
See LICENSE-APACHE, and LICENSE-MIT for details.
+14
View File
@@ -0,0 +1,14 @@
//! Set a nightly feature
extern crate rustc_version;
use rustc_version::{version, version_meta, Channel};
fn main() {
// Assert we haven't travelled back in time
assert!(version().unwrap().major >= 1);
// Set cfg flags depending on release channel
if let Channel::Nightly = version_meta().unwrap().channel {
println!("cargo:rustc-cfg=feature=\"nightly\"");
}
}
+36
View File
@@ -0,0 +1,36 @@
#![warn(missing_docs)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![no_std]
#![crate_type = "rlib"]
#![cfg_attr(feature = "nightly", feature(global_allocator))]
#![cfg_attr(feature = "nightly", feature(alloc))]
#![cfg_attr(feature = "nightly", feature(allocator_api))]
//! Custom allocator crate for wasm
/// Wasm allocator
pub struct WasmAllocator;
#[cfg(feature = "nightly")]
#[global_allocator]
static ALLOCATOR: WasmAllocator = WasmAllocator;
#[cfg(feature = "nightly")]
mod __impl {
extern crate alloc;
extern crate pwasm_libc;
use self::alloc::heap::{Alloc, Layout, AllocErr};
use super::WasmAllocator;
unsafe impl<'a> Alloc for &'a WasmAllocator {
unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
Ok(pwasm_libc::malloc(layout.size()))
}
unsafe fn dealloc(&mut self, ptr: *mut u8, _layout: Layout) {
pwasm_libc::free(ptr)
}
}
}