diff --git a/CHANGELOG.md b/CHANGELOG.md index 0856e49dc..c1d93420b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## **[Unreleased]** +## 0.16.0 - 2020-03-11 + +- [#1286](https://github.com/wasmerio/wasmer/pull/1286) Updated Windows Wasmer icons. Add wax +- [#1284](https://github.com/wasmerio/wasmer/pull/1284) Implement string and memory instructions in `wasmer-interface-types` - [#1272](https://github.com/wasmerio/wasmer/pull/1272) Fix off-by-one error bug when accessing memory with a `WasmPtr` that contains the last valid byte of memory. Also changes the behavior of `WasmPtr` with a length of 0 and `WasmPtr` where `std::mem::size_of::()` is 0 to always return `None` ## 0.15.0 - 2020-03-04 diff --git a/Cargo.lock b/Cargo.lock index ee781d901..57aba6cea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "0.15.0" +version = "0.16.0" dependencies = [ "atty", "byteorder", @@ -1851,7 +1851,7 @@ dependencies = [ [[package]] name = "wasmer-clif-backend" -version = "0.15.0" +version = "0.16.0" dependencies = [ "byteorder", "cranelift-codegen", @@ -1902,14 +1902,14 @@ dependencies = [ [[package]] name = "wasmer-dev-utils" -version = "0.15.0" +version = "0.16.0" dependencies = [ "libc", ] [[package]] name = "wasmer-emscripten" -version = "0.15.0" +version = "0.16.0" dependencies = [ "byteorder", "getrandom", @@ -1922,7 +1922,7 @@ dependencies = [ [[package]] name = "wasmer-emscripten-tests" -version = "0.15.0" +version = "0.16.0" dependencies = [ "glob 0.3.0", "wabt", @@ -1936,7 +1936,7 @@ dependencies = [ [[package]] name = "wasmer-interface-types" -version = "0.15.0" +version = "0.16.0" dependencies = [ "nom", "wast", @@ -1952,7 +1952,7 @@ dependencies = [ [[package]] name = "wasmer-llvm-backend" -version = "0.15.0" +version = "0.16.0" dependencies = [ "byteorder", "cc", @@ -1983,14 +1983,14 @@ dependencies = [ [[package]] name = "wasmer-middleware-common" -version = "0.15.0" +version = "0.16.0" dependencies = [ "wasmer-runtime-core", ] [[package]] name = "wasmer-middleware-common-tests" -version = "0.15.0" +version = "0.16.0" dependencies = [ "criterion", "wabt", @@ -2003,7 +2003,7 @@ dependencies = [ [[package]] name = "wasmer-runtime" -version = "0.15.0" +version = "0.16.0" dependencies = [ "criterion", "lazy_static", @@ -2020,7 +2020,7 @@ dependencies = [ [[package]] name = "wasmer-runtime-c-api" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cbindgen", "libc", @@ -2032,7 +2032,7 @@ dependencies = [ [[package]] name = "wasmer-runtime-core" -version = "0.15.0" +version = "0.16.0" dependencies = [ "bincode", "blake3", @@ -2060,7 +2060,7 @@ dependencies = [ [[package]] name = "wasmer-runtime-core-tests" -version = "0.15.0" +version = "0.16.0" dependencies = [ "wabt", "wasmer-clif-backend", @@ -2071,7 +2071,7 @@ dependencies = [ [[package]] name = "wasmer-singlepass-backend" -version = "0.15.0" +version = "0.16.0" dependencies = [ "bincode", "byteorder", @@ -2088,7 +2088,7 @@ dependencies = [ [[package]] name = "wasmer-spectests" -version = "0.15.0" +version = "0.16.0" dependencies = [ "glob 0.3.0", "wabt", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "wasmer-wasi" -version = "0.15.0" +version = "0.16.0" dependencies = [ "bincode", "byteorder", @@ -2117,7 +2117,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-experimental-io-devices" -version = "0.15.0" +version = "0.16.0" dependencies = [ "log", "minifb", @@ -2130,7 +2130,7 @@ dependencies = [ [[package]] name = "wasmer-wasi-tests" -version = "0.15.0" +version = "0.16.0" dependencies = [ "glob 0.3.0", "wasmer-clif-backend", @@ -2143,7 +2143,7 @@ dependencies = [ [[package]] name = "wasmer-win-exception-handler" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cmake", "libc", diff --git a/Cargo.toml b/Cargo.toml index b3f532d57..9a360270f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer" -version = "0.15.0" +version = "0.16.0" authors = ["The Wasmer Engineering Team "] edition = "2018" repository = "https://github.com/wasmerio/wasmer" diff --git a/Makefile b/Makefile index c8f755538..601421c91 100644 --- a/Makefile +++ b/Makefile @@ -287,6 +287,8 @@ build-install-package: mkdir -p ./install/bin cp ./wapm-cli/target/release/wapm ./install/bin/ cp ./target/release/wasmer ./install/bin/ + # Create the wax binary as symlink to wapm + cd ./install/bin/ && ln -s wapm wax tar -C ./install -zcvf wasmer.tar.gz bin/wapm bin/wasmer UNAME_S := $(shell uname -s) @@ -315,7 +317,7 @@ endif cp lib/runtime-c-api/doc/index.md ./capi/README.md tar -C ./capi -zcvf wasmer-c-api.tar.gz lib include README.md LICENSE -WAPM_VERSION = 0.4.3 +WAPM_VERSION = v0.5.0 build-wapm: git clone --branch $(WAPM_VERSION) https://github.com/wasmerio/wapm-cli.git cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications" diff --git a/lib/clif-backend/Cargo.toml b/lib/clif-backend/Cargo.toml index 282f4e2d1..9a2fc85ec 100644 --- a/lib/clif-backend/Cargo.toml +++ b/lib/clif-backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-clif-backend" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime Cranelift compiler backend" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -11,7 +11,7 @@ edition = "2018" readme = "README.md" [dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } cranelift-native = "0.59.0" cranelift-codegen = "0.59.0" cranelift-entity = "0.59.0" @@ -38,7 +38,7 @@ version = "0.0.7" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] } -wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.15.0" } +wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.16.0" } [features] generate-debug-information = ["wasm-debug"] diff --git a/lib/dev-utils/Cargo.toml b/lib/dev-utils/Cargo.toml index 1c06313ba..404efd77a 100644 --- a/lib/dev-utils/Cargo.toml +++ b/lib/dev-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-dev-utils" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime core library" license = "MIT" authors = ["The Wasmer Engineering Team "] diff --git a/lib/emscripten-tests/Cargo.toml b/lib/emscripten-tests/Cargo.toml index 2e6e68a6f..4df41605d 100644 --- a/lib/emscripten-tests/Cargo.toml +++ b/lib/emscripten-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten-tests" -version = "0.15.0" +version = "0.16.0" description = "Tests for our Emscripten implementation" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -9,15 +9,15 @@ publish = false build = "build/mod.rs" [dependencies] -wasmer-emscripten = { path = "../emscripten", version = "0.15.0" } -wasmer-runtime = { path = "../runtime", version = "0.15.0", default-features = false } -wasmer-clif-backend = { path = "../clif-backend", version = "0.15.0", optional = true} -wasmer-llvm-backend = { path = "../llvm-backend", version = "0.15.0", optional = true, features = ["test"] } -wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.15.0", optional = true } +wasmer-emscripten = { path = "../emscripten", version = "0.16.0" } +wasmer-runtime = { path = "../runtime", version = "0.16.0", default-features = false } +wasmer-clif-backend = { path = "../clif-backend", version = "0.16.0", optional = true} +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.0", optional = true, features = ["test"] } +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.0", optional = true } [dev-dependencies] wabt = "0.9.1" -wasmer-dev-utils = { path = "../dev-utils", version = "0.15.0"} +wasmer-dev-utils = { path = "../dev-utils", version = "0.16.0"} [build-dependencies] glob = "0.3" diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index 25091e89b..cb946a491 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-emscripten" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime emscripten implementation library" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -15,7 +15,7 @@ lazy_static = "1.4" libc = "0.2.60" log = "0.4" time = "0.1" -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } [target.'cfg(windows)'.dependencies] getrandom = "0.1" diff --git a/lib/interface-types/Cargo.toml b/lib/interface-types/Cargo.toml index 44758c1fe..6915304af 100644 --- a/lib/interface-types/Cargo.toml +++ b/lib/interface-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-interface-types" -version = "0.15.0" +version = "0.16.0" description = "WebAssembly Interface Types library for Wasmer" license = "MIT" authors = ["The Wasmer Engineering Team "] diff --git a/lib/interface-types/README.md b/lib/interface-types/README.md index 242b14ea2..f8f349013 100644 --- a/lib/interface-types/README.md +++ b/lib/interface-types/README.md @@ -30,3 +30,68 @@ more](https://github.com/wasmerio/wasmer). This crate is an implementation of [the living WebAssembly Interface Types standard](https://github.com/WebAssembly/interface-types). + +## Encoders and decoders + +The `wasmer-interface-types` crate comes with an encoder and a decoder +for the WAT format, and the binary format, for the WebAssembly +Interface Types. An encoder writes an AST into another format, like +WAT or binary. A decoder reads an AST from another format, like WAT or +binary. + +## Instructions + +Very basically, WebAssembly Interface Types defines a set of +instructions, used by adapters to transform the data between +WebAssembly core and the outside world ([learn +mode](https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.md)). + +Here is the instructions that are implemented: + +| Instruction | WAT encoder | Binary encoder | WAT decoder | Binary decoder | Interpreter | +|-|-|-|-|-|-| +| `arg.get` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `call-core` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `memory-to-string` | ❌ | ❌ | ❌ | ❌ | ❌ | +| `string-to-memory` | ❌ | ❌ | ❌ | ❌ | ❌ | +| `call-adapter` | ❌ | ❌ | ❌ | ❌ | ❌ | +| `defer-call-core` | ❌ | ❌ | ❌ | ❌ | ❌ | +| `i32-to-s8` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-s8x` | ✅ | ✅ | ✅ | ✅ | ❌ | +| `i32-to-u8` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-s16` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-s16x` | ✅ | ✅ | ✅ | ✅ | ❌ | +| `i32-to-u16` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-s32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-u32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-s64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i32-to-u64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s8` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s8x` | ✅ | ✅ | ✅ | ✅ | ❌ | +| `i64-to-u8` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s16` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s16x` | ✅ | ✅ | ✅ | ✅ | ❌ | +| `i64-to-u16` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s32x` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-u32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-s64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `i64-to-u64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s8-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u8-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s16-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u16-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s32-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u32-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s64-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s64-to-i32x` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u64-to-i32` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u64-to-i32x` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s8-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u8-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s16-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u16-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s32-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u32-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `s64-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | +| `u64-to-i64` | ✅ | ✅ | ✅ | ✅ | ✅ | diff --git a/lib/interface-types/src/ast.rs b/lib/interface-types/src/ast.rs index 20a671965..21b76020d 100644 --- a/lib/interface-types/src/ast.rs +++ b/lib/interface-types/src/ast.rs @@ -51,12 +51,16 @@ pub enum InterfaceType { } /// Represents a type signature. +/// +/// ```wasm,ignore +/// (@interface type (param i32 i32) (result string)) +/// ``` #[derive(PartialEq, Debug)] pub struct Type { - /// Types for the parameters. + /// Types for the parameters (`(param …)`). pub inputs: Vec, - /// Types for the results. + /// Types for the results (`(result …)`). pub outputs: Vec, } @@ -85,12 +89,12 @@ pub struct Export<'input> { /// Represents an adapter. #[derive(PartialEq, Debug)] -pub struct Adapter<'input> { +pub struct Adapter { /// The adapter function type. pub function_type: u32, /// The instructions. - pub instructions: Vec>, + pub instructions: Vec, } /// Represents an implementation. @@ -133,7 +137,7 @@ pub struct Interfaces<'input> { pub imports: Vec>, /// All the adapters. - pub adapters: Vec>, + pub adapters: Vec, /// All the exported functions. pub exports: Vec>, diff --git a/lib/interface-types/src/decoders/binary.rs b/lib/interface-types/src/decoders/binary.rs index 571548c9f..9dc0f8c7b 100644 --- a/lib/interface-types/src/decoders/binary.rs +++ b/lib/interface-types/src/decoders/binary.rs @@ -168,30 +168,20 @@ fn instruction<'input, E: ParseError<&'input [u8]>>( consume!((input, argument_0) = uleb(input)?); ( input, - Instruction::Call { + Instruction::CallCore { function_index: argument_0 as usize, }, ) } - 0x02 => { - consume!((input, argument_0) = string(input)?); - ( - input, - Instruction::CallExport { - export_name: argument_0, - }, - ) - } - - 0x03 => (input, Instruction::ReadUtf8), + 0x03 => (input, Instruction::MemoryToString), 0x04 => { - consume!((input, argument_0) = string(input)?); + consume!((input, argument_0) = uleb(input)?); ( input, - Instruction::WriteUtf8 { - allocator_name: argument_0, + Instruction::StringToMemory { + allocator_index: argument_0 as u32, }, ) } @@ -637,12 +627,11 @@ mod tests { #[test] fn test_instructions() { let input = &[ - 0x2c, // list of 44 items + 0x2b, // list of 43 items 0x00, 0x01, // ArgumentGet { index: 1 } - 0x01, 0x01, // Call { function_index: 1 } - 0x02, 0x03, 0x61, 0x62, 0x63, // CallExport { export_name: "abc" } - 0x03, // ReadUtf8 - 0x04, 0x03, 0x61, 0x62, 0x63, // WriteUtf8 { allocator_name: "abc" } + 0x01, 0x01, // CallCore { function_index: 1 } + 0x03, // MemoryToString + 0x04, 0x01, // StringToMemory { allocator_index: 1 } 0x07, // I32ToS8 0x08, // I32ToS8X 0x09, // I32ToU8 @@ -688,12 +677,9 @@ mod tests { &[0x0a][..], vec![ Instruction::ArgumentGet { index: 1 }, - Instruction::Call { function_index: 1 }, - Instruction::CallExport { export_name: "abc" }, - Instruction::ReadUtf8, - Instruction::WriteUtf8 { - allocator_name: "abc", - }, + Instruction::CallCore { function_index: 1 }, + Instruction::MemoryToString, + Instruction::StringToMemory { allocator_index: 1 }, Instruction::I32ToS8, Instruction::I32ToS8X, Instruction::I32ToU8, diff --git a/lib/interface-types/src/decoders/wat.rs b/lib/interface-types/src/decoders/wat.rs index 2342017ed..809b5e5a6 100644 --- a/lib/interface-types/src/decoders/wat.rs +++ b/lib/interface-types/src/decoders/wat.rs @@ -27,10 +27,9 @@ mod keyword { // Instructions. custom_keyword!(argument_get = "arg.get"); - custom_keyword!(call); - custom_keyword!(call_export = "call-export"); - custom_keyword!(read_utf8 = "read-utf8"); - custom_keyword!(write_utf8 = "write-utf8"); + custom_keyword!(call_core = "call-core"); + custom_keyword!(memory_to_string = "memory-to-string"); + custom_keyword!(string_to_memory = "string-to-memory"); custom_keyword!(i32_to_s8 = "i32-to-s8"); custom_keyword!(i32_to_s8x = "i32-to-s8x"); custom_keyword!(i32_to_u8 = "i32-to-u8"); @@ -138,7 +137,7 @@ impl Parse<'_> for InterfaceType { } } -impl<'a> Parse<'a> for Instruction<'a> { +impl<'a> Parse<'a> for Instruction { #[allow(clippy::cognitive_complexity)] fn parse(parser: Parser<'a>) -> Result { let mut lookahead = parser.lookahead1(); @@ -149,27 +148,21 @@ impl<'a> Parse<'a> for Instruction<'a> { Ok(Instruction::ArgumentGet { index: parser.parse()?, }) - } else if lookahead.peek::() { - parser.parse::()?; + } else if lookahead.peek::() { + parser.parse::()?; - Ok(Instruction::Call { + Ok(Instruction::CallCore { function_index: parser.parse::()? as usize, }) - } else if lookahead.peek::() { - parser.parse::()?; + } else if lookahead.peek::() { + parser.parse::()?; - Ok(Instruction::CallExport { - export_name: parser.parse()?, - }) - } else if lookahead.peek::() { - parser.parse::()?; + Ok(Instruction::MemoryToString) + } else if lookahead.peek::() { + parser.parse::()?; - Ok(Instruction::ReadUtf8) - } else if lookahead.peek::() { - parser.parse::()?; - - Ok(Instruction::WriteUtf8 { - allocator_name: parser.parse()?, + Ok(Instruction::StringToMemory { + allocator_index: parser.parse()?, }) } else if lookahead.peek::() { parser.parse::()?; @@ -399,7 +392,7 @@ impl Parse<'_> for FunctionType { enum Interface<'a> { Type(Type), Import(Import<'a>), - Adapter(Adapter<'a>), + Adapter(Adapter), Export(Export<'a>), Implementation(Implementation), } @@ -527,7 +520,7 @@ impl<'a> Parse<'a> for Implementation { } } -impl<'a> Parse<'a> for Adapter<'a> { +impl<'a> Parse<'a> for Adapter { fn parse(parser: Parser<'a>) -> Result { parser.parse::()?; @@ -673,10 +666,9 @@ mod tests { fn test_instructions() { let inputs = vec![ "arg.get 7", - "call 7", - r#"call-export "foo""#, - "read-utf8", - r#"write-utf8 "foo""#, + "call-core 7", + "memory-to-string", + "string-to-memory 42", "i32-to-s8", "i32-to-s8x", "i32-to-u8", @@ -719,11 +711,10 @@ mod tests { ]; let outputs = vec![ Instruction::ArgumentGet { index: 7 }, - Instruction::Call { function_index: 7 }, - Instruction::CallExport { export_name: "foo" }, - Instruction::ReadUtf8, - Instruction::WriteUtf8 { - allocator_name: "foo", + Instruction::CallCore { function_index: 7 }, + Instruction::MemoryToString, + Instruction::StringToMemory { + allocator_index: 42, }, Instruction::I32ToS8, Instruction::I32ToS8X, diff --git a/lib/interface-types/src/encoders/binary.rs b/lib/interface-types/src/encoders/binary.rs index 7486d5eb4..cd322232d 100644 --- a/lib/interface-types/src/encoders/binary.rs +++ b/lib/interface-types/src/encoders/binary.rs @@ -162,7 +162,7 @@ where /// Encode an `Adapter` into bytes. /// /// Decoder is in `decoders::binary::adapters`. -impl ToBytes for Adapter<'_> +impl ToBytes for Adapter where W: Write, { @@ -244,7 +244,7 @@ where /// Encode an `Instruction` into bytes. /// /// Decoder is `decoders::binary::instruction`. -impl ToBytes for Instruction<'_> +impl ToBytes for Instruction where W: Write, { @@ -255,21 +255,16 @@ where (*index as u64).to_bytes(writer)?; } - Instruction::Call { function_index } => { + Instruction::CallCore { function_index } => { 0x01_u8.to_bytes(writer)?; (*function_index as u64).to_bytes(writer)?; } - Instruction::CallExport { export_name } => { - 0x02_u8.to_bytes(writer)?; - export_name.to_bytes(writer)?; - } + Instruction::MemoryToString => 0x03_u8.to_bytes(writer)?, - Instruction::ReadUtf8 => 0x03_u8.to_bytes(writer)?, - - Instruction::WriteUtf8 { allocator_name } => { + Instruction::StringToMemory { allocator_index } => { 0x04_u8.to_bytes(writer)?; - allocator_name.to_bytes(writer)?; + (*allocator_index as u64).to_bytes(writer)?; } Instruction::I32ToS8 => 0x07_u8.to_bytes(writer)?, @@ -554,12 +549,9 @@ mod tests { assert_to_bytes!( vec![ Instruction::ArgumentGet { index: 1 }, - Instruction::Call { function_index: 1 }, - Instruction::CallExport { export_name: "abc" }, - Instruction::ReadUtf8, - Instruction::WriteUtf8 { - allocator_name: "abc", - }, + Instruction::CallCore { function_index: 1 }, + Instruction::MemoryToString, + Instruction::StringToMemory { allocator_index: 1 }, Instruction::I32ToS8, Instruction::I32ToS8X, Instruction::I32ToU8, @@ -601,12 +593,11 @@ mod tests { Instruction::U64ToI64, ], &[ - 0x2c, // list of 44 items + 0x2b, // list of 43 items 0x00, 0x01, // ArgumentGet { index: 1 } - 0x01, 0x01, // Call { function_index: 1 } - 0x02, 0x03, 0x61, 0x62, 0x63, // CallExport { export_name: "abc" } - 0x03, // ReadUtf8 - 0x04, 0x03, 0x61, 0x62, 0x63, // WriteUtf8 { allocator_name: "abc" } + 0x01, 0x01, // CallCore { function_index: 1 } + 0x03, // MemoryToString + 0x04, 0x01, // StringToMemory { allocator_index: 1 } 0x07, // I32ToS8 0x08, // I32ToS8X 0x09, // I32ToU8 diff --git a/lib/interface-types/src/encoders/wat.rs b/lib/interface-types/src/encoders/wat.rs index 1e883b764..74a9d1a15 100644 --- a/lib/interface-types/src/encoders/wat.rs +++ b/lib/interface-types/src/encoders/wat.rs @@ -80,15 +80,14 @@ impl ToString for &InterfaceType { } /// Encode an `Instruction` into a string. -impl<'input> ToString for &Instruction<'input> { +impl ToString for &Instruction { fn to_string(&self) -> String { match self { Instruction::ArgumentGet { index } => format!("arg.get {}", index), - Instruction::Call { function_index } => format!("call {}", function_index), - Instruction::CallExport { export_name } => format!(r#"call-export "{}""#, export_name), - Instruction::ReadUtf8 => "read-utf8".into(), - Instruction::WriteUtf8 { allocator_name } => { - format!(r#"write-utf8 "{}""#, allocator_name) + Instruction::CallCore { function_index } => format!("call-core {}", function_index), + Instruction::MemoryToString => "memory-to-string".into(), + Instruction::StringToMemory { allocator_index } => { + format!(r#"string-to-memory {}"#, allocator_index) } Instruction::I32ToS8 => "i32-to-s8".into(), Instruction::I32ToS8X => "i32-to-s8x".into(), @@ -195,7 +194,7 @@ impl<'input> ToString for &Import<'input> { } /// Encode an `Adapter` into a string. -impl<'input> ToString for &Adapter<'input> { +impl ToString for &Adapter { fn to_string(&self) -> String { format!( r#"(@interface func (type {function_type}){instructions})"#, @@ -361,11 +360,10 @@ mod tests { fn test_instructions() { let inputs: Vec = vec![ (&Instruction::ArgumentGet { index: 7 }).to_string(), - (&Instruction::Call { function_index: 7 }).to_string(), - (&Instruction::CallExport { export_name: "foo" }).to_string(), - (&Instruction::ReadUtf8).to_string(), - (&Instruction::WriteUtf8 { - allocator_name: "foo", + (&Instruction::CallCore { function_index: 7 }).to_string(), + (&Instruction::MemoryToString).to_string(), + (&Instruction::StringToMemory { + allocator_index: 42, }) .to_string(), (&Instruction::I32ToS8).to_string(), @@ -410,10 +408,9 @@ mod tests { ]; let outputs = vec![ "arg.get 7", - "call 7", - r#"call-export "foo""#, - "read-utf8", - r#"write-utf8 "foo""#, + "call-core 7", + "memory-to-string", + "string-to-memory 42", "i32-to-s8", "i32-to-s8x", "i32-to-u8", diff --git a/lib/interface-types/src/interpreter/instruction.rs b/lib/interface-types/src/interpreter/instruction.rs index feca1cc7e..109f269b8 100644 --- a/lib/interface-types/src/interpreter/instruction.rs +++ b/lib/interface-types/src/interpreter/instruction.rs @@ -2,32 +2,26 @@ /// Represents all the possible WIT instructions. #[derive(PartialEq, Debug)] -pub enum Instruction<'input> { +pub enum Instruction { /// The `arg.get` instruction. ArgumentGet { /// The argument index. index: u32, }, - /// The `call` instruction. - Call { + /// The `call-core` instruction. + CallCore { /// The function index. function_index: usize, }, - /// The `call-export` instruction. - CallExport { - /// The exported function name. - export_name: &'input str, - }, + /// The `memory-to-string` instruction. + MemoryToString, - /// The `read-utf8` instruction. - ReadUtf8, - - /// The `write-utf8` instruction. - WriteUtf8 { - /// The allocator function name. - allocator_name: &'input str, + /// The `string-to-memory` instruction. + StringToMemory { + /// The allocator function index. + allocator_index: u32, }, /// The `i32-to-s8,` instruction. diff --git a/lib/interface-types/src/interpreter/instructions/call.rs b/lib/interface-types/src/interpreter/instructions/call_core.rs similarity index 81% rename from lib/interface-types/src/interpreter/instructions/call.rs rename to lib/interface-types/src/interpreter/instructions/call_core.rs index 5fe896bb9..3179c9080 100644 --- a/lib/interface-types/src/interpreter/instructions/call.rs +++ b/lib/interface-types/src/interpreter/instructions/call_core.rs @@ -4,7 +4,7 @@ use crate::interpreter::wasm::{ }; executable_instruction!( - call(function_index: usize, instruction_name: String) -> _ { + call_core(function_index: usize, instruction_name: String) -> _ { move |runtime| -> _ { let instance = &mut runtime.wasm_instance; let index = FunctionIndex::new(function_index); @@ -65,11 +65,11 @@ executable_instruction!( #[cfg(test)] mod tests { test_executable_instruction!( - test_call = + test_call_core = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::Call { function_index: 42 }, + Instruction::CallCore { function_index: 42 }, ], invocation_inputs: [ InterfaceValue::I32(3), @@ -80,39 +80,39 @@ mod tests { ); test_executable_instruction!( - test_call__invalid_local_import_index = + test_call_core__invalid_local_import_index = instructions: [ - Instruction::Call { function_index: 42 }, + Instruction::CallCore { function_index: 42 }, ], invocation_inputs: [ InterfaceValue::I32(3), InterfaceValue::I32(4), ], instance: Default::default(), - error: r#"`call 42` cannot call the local or imported function `42` because it doesn't exist."#, + error: r#"`call-core 42` cannot call the local or imported function `42` because it doesn't exist."#, ); test_executable_instruction!( - test_call__stack_is_too_small = + test_call_core__stack_is_too_small = instructions: [ Instruction::ArgumentGet { index: 0 }, - Instruction::Call { function_index: 42 }, - // ^^ `42` expects 2 values on the stack, only one is present + Instruction::CallCore { function_index: 42 }, + // ^^ `42` expects 2 values on the stack, only one is present ], invocation_inputs: [ InterfaceValue::I32(3), InterfaceValue::I32(4), ], instance: Instance::new(), - error: r#"`call 42` cannot call the local or imported function `42` because there is not enough data on the stack for the arguments (needs 2)."#, + error: r#"`call-core 42` cannot call the local or imported function `42` because there is not enough data on the stack for the arguments (needs 2)."#, ); test_executable_instruction!( - test_call__invalid_types_in_the_stack = + test_call_core__invalid_types_in_the_stack = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::Call { function_index: 42 }, + Instruction::CallCore { function_index: 42 }, ], invocation_inputs: [ InterfaceValue::I32(3), @@ -120,15 +120,15 @@ mod tests { // ^^^ mismatch with `42` signature ], instance: Instance::new(), - error: r#"`call 42` cannot call the local or imported function `42` because the value types on the stack mismatch the function signature (expects [I32, I32])."#, + error: r#"`call-core 42` cannot call the local or imported function `42` because the value types on the stack mismatch the function signature (expects [I32, I32])."#, ); test_executable_instruction!( - test_call__failure_when_calling = + test_call_core__failure_when_calling = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::Call { function_index: 42 }, + Instruction::CallCore { function_index: 42 }, ], invocation_inputs: [ InterfaceValue::I32(3), @@ -151,15 +151,15 @@ mod tests { }, ..Default::default() }, - error: r#"`call 42` failed when calling the local or imported function `42`."#, + error: r#"`call-core 42` failed when calling the local or imported function `42`."#, ); test_executable_instruction!( - test_call__void = + test_call_core__void = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::Call { function_index: 42 }, + Instruction::CallCore { function_index: 42 }, ], invocation_inputs: [ InterfaceValue::I32(3), diff --git a/lib/interface-types/src/interpreter/instructions/call_export.rs b/lib/interface-types/src/interpreter/instructions/call_export.rs deleted file mode 100644 index 9afe98417..000000000 --- a/lib/interface-types/src/interpreter/instructions/call_export.rs +++ /dev/null @@ -1,177 +0,0 @@ -use crate::interpreter::wasm::values::InterfaceType; - -executable_instruction!( - call_export(export_name: String, instruction_name: String) -> _ { - move |runtime| -> _ { - let instance = &mut runtime.wasm_instance; - - match instance.export(&export_name) { - Some(export) => { - let inputs_cardinality = export.inputs_cardinality(); - - match runtime.stack.pop(inputs_cardinality) { - Some(inputs) => { - let input_types = inputs - .iter() - .map(Into::into) - .collect::>(); - - if input_types != export.inputs() { - return Err(format!( - "`{}` cannot call the exported function `{}` because the value types on the stack mismatch the function signature (expects {:?}).", - instruction_name, - export_name, - export.inputs(), - )) - } - - match export.call(&inputs) { - Ok(outputs) => { - for output in outputs.iter() { - runtime.stack.push(output.clone()); - } - - Ok(()) - } - Err(_) => Err(format!( - "`{}` failed when calling the exported function `{}`.", - instruction_name, - export_name - )) - } - } - None => Err(format!( - "`{}` cannot call the exported function `{}` because there is not enough data on the stack for the arguments (needs {}).", - instruction_name, - export_name, - inputs_cardinality, - )) - } - } - None => Err(format!( - "`{}` cannot call the exported function `{}` because it doesn't exist.", - instruction_name, - export_name, - )) - } - } - } -); - -#[cfg(test)] -mod tests { - test_executable_instruction!( - test_call_export = - instructions: [ - Instruction::ArgumentGet { index: 1 }, - Instruction::ArgumentGet { index: 0 }, - Instruction::CallExport { export_name: "sum" }, - ], - invocation_inputs: [ - InterfaceValue::I32(3), - InterfaceValue::I32(4), - ], - instance: Instance::new(), - stack: [InterfaceValue::I32(7)], - ); - - test_executable_instruction!( - test_call_export__invalid_export_name = - instructions: [Instruction::CallExport { export_name: "bar" }], - invocation_inputs: [], - instance: Instance::new(), - error: r#"`call-export "bar"` cannot call the exported function `bar` because it doesn't exist."#, - ); - - test_executable_instruction!( - test_call_export__stack_is_too_small = - instructions: [ - Instruction::ArgumentGet { index: 0 }, - Instruction::CallExport { export_name: "sum" }, - ], - invocation_inputs: [ - InterfaceValue::I32(3), - InterfaceValue::I32(4), - ], - instance: Instance::new(), - error: r#"`call-export "sum"` cannot call the exported function `sum` because there is not enough data on the stack for the arguments (needs 2)."#, - ); - - test_executable_instruction!( - test_call_export__invalid_types_in_the_stack = - instructions: [ - Instruction::ArgumentGet { index: 1 }, - Instruction::ArgumentGet { index: 0 }, - Instruction::CallExport { export_name: "sum" }, - ], - invocation_inputs: [ - InterfaceValue::I32(3), - InterfaceValue::I64(4), - // ^^^ mismatch with `sum` signature - ], - instance: Instance::new(), - error: r#"`call-export "sum"` cannot call the exported function `sum` because the value types on the stack mismatch the function signature (expects [I32, I32])."#, - ); - - test_executable_instruction!( - test_call_export__failure_when_calling = - instructions: [ - Instruction::ArgumentGet { index: 1 }, - Instruction::ArgumentGet { index: 0 }, - Instruction::CallExport { export_name: "sum" }, - ], - invocation_inputs: [ - InterfaceValue::I32(3), - InterfaceValue::I32(4), - ], - instance: Instance { - exports: { - let mut hashmap = HashMap::new(); - hashmap.insert( - "sum".into(), - Export { - inputs: vec![InterfaceType::I32, InterfaceType::I32], - outputs: vec![InterfaceType::I32], - function: |_| Err(()), - // ^^^^^^^ function fails - }, - ); - - hashmap - }, - ..Default::default() - }, - error: r#"`call-export "sum"` failed when calling the exported function `sum`."#, - ); - - test_executable_instruction!( - test_call_export__void = - instructions: [ - Instruction::ArgumentGet { index: 1 }, - Instruction::ArgumentGet { index: 0 }, - Instruction::CallExport { export_name: "sum" }, - ], - invocation_inputs: [ - InterfaceValue::I32(3), - InterfaceValue::I32(4), - ], - instance: Instance { - exports: { - let mut hashmap = HashMap::new(); - hashmap.insert( - "sum".into(), - Export { - inputs: vec![InterfaceType::I32, InterfaceType::I32], - outputs: vec![InterfaceType::I32], - function: |_| Ok(vec![]), - // ^^^^^^^^^^ void function - }, - ); - - hashmap - }, - ..Default::default() - }, - stack: [], - ); -} diff --git a/lib/interface-types/src/interpreter/instructions/read_utf8.rs b/lib/interface-types/src/interpreter/instructions/memory_to_string.rs similarity index 82% rename from lib/interface-types/src/interpreter/instructions/read_utf8.rs rename to lib/interface-types/src/interpreter/instructions/memory_to_string.rs index a06bc5630..678d08d74 100644 --- a/lib/interface-types/src/interpreter/instructions/read_utf8.rs +++ b/lib/interface-types/src/interpreter/instructions/memory_to_string.rs @@ -2,7 +2,7 @@ use crate::interpreter::wasm::values::InterfaceValue; use std::{cell::Cell, convert::TryFrom}; executable_instruction!( - read_utf8(instruction_name: String) -> _ { + memory_to_string(instruction_name: String) -> _ { move |runtime| -> _ { match runtime.stack.pop(2) { Some(inputs) => match runtime.wasm_instance.memory(0) { @@ -55,11 +55,11 @@ executable_instruction!( #[cfg(test)] mod tests { test_executable_instruction!( - test_read_utf8 = + test_memory_to_string = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::ReadUtf8, + Instruction::MemoryToString, ], invocation_inputs: [ InterfaceValue::I32(13), @@ -75,11 +75,11 @@ mod tests { ); test_executable_instruction!( - test_read_utf8__read_out_of_memory = + test_memory_to_string__read_out_of_memory = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::ReadUtf8, + Instruction::MemoryToString, ], invocation_inputs: [ InterfaceValue::I32(13), @@ -91,15 +91,15 @@ mod tests { memory: Memory::new("Hello!".as_bytes().iter().map(|u| Cell::new(*u)).collect()), ..Default::default() }, - error: r#"`read-utf8` failed because it has to read out of the memory bounds (index 13 > memory length 6)."#, + error: r#"`memory-to-string` failed because it has to read out of the memory bounds (index 13 > memory length 6)."#, ); test_executable_instruction!( - test_read_utf8__invalid_encoding = + test_memory_to_string__invalid_encoding = instructions: [ Instruction::ArgumentGet { index: 1 }, Instruction::ArgumentGet { index: 0 }, - Instruction::ReadUtf8, + Instruction::MemoryToString, ], invocation_inputs: [ InterfaceValue::I32(4), @@ -111,21 +111,21 @@ mod tests { memory: Memory::new(vec![0, 159, 146, 150].iter().map(|b| Cell::new(*b)).collect::>>()), ..Default::default() }, - error: r#"`read-utf8` failed because the read string isn't UTF-8 valid (invalid utf-8 sequence of 1 bytes from index 1)."#, + error: r#"`memory-to-string` failed because the read string isn't UTF-8 valid (invalid utf-8 sequence of 1 bytes from index 1)."#, ); test_executable_instruction!( - test_read_utf8__stack_is_too_small = + test_memory_to_string__stack_is_too_small = instructions: [ Instruction::ArgumentGet { index: 0 }, - Instruction::ReadUtf8, - // ^^^^^^^^ `read-utf8` expects 2 values on the stack, only one is present. + Instruction::MemoryToString, + // ^^^^^^^^^^^^^^ `memory-to-string` expects 2 values on the stack, only one is present. ], invocation_inputs: [ InterfaceValue::I32(13), InterfaceValue::I32(0), ], instance: Instance::new(), - error: r#"`read-utf8` failed because there is not enough data on the stack (needs 2)."#, + error: r#"`memory-to-string` failed because there is not enough data on the stack (needs 2)."#, ); } diff --git a/lib/interface-types/src/interpreter/instructions/mod.rs b/lib/interface-types/src/interpreter/instructions/mod.rs index 28aa5209b..8466b9938 100644 --- a/lib/interface-types/src/interpreter/instructions/mod.rs +++ b/lib/interface-types/src/interpreter/instructions/mod.rs @@ -1,16 +1,14 @@ mod argument_get; -mod call; -mod call_export; +mod call_core; mod lowering_lifting; -mod read_utf8; -mod write_utf8; +mod memory_to_string; +mod string_to_memory; pub(crate) use argument_get::argument_get; -pub(crate) use call::call; -pub(crate) use call_export::call_export; +pub(crate) use call_core::call_core; pub(crate) use lowering_lifting::*; -pub(crate) use read_utf8::read_utf8; -pub(crate) use write_utf8::write_utf8; +pub(crate) use memory_to_string::memory_to_string; +pub(crate) use string_to_memory::string_to_memory; #[cfg(test)] pub(crate) mod tests { @@ -133,23 +131,12 @@ pub(crate) mod tests { }, }, ); - hashmap.insert( - "alloc".into(), - Export { - inputs: vec![InterfaceType::I32], - outputs: vec![InterfaceType::I32], - function: |arguments: &[InterfaceValue]| { - let _size: i32 = (&arguments[0]).try_into().unwrap(); - - Ok(vec![InterfaceValue::I32(0)]) - }, - }, - ); hashmap }, locals_or_imports: { let mut hashmap = HashMap::new(); + // sum hashmap.insert( 42, LocalImport { @@ -163,6 +150,19 @@ pub(crate) mod tests { }, }, ); + // string allocator + hashmap.insert( + 43, + LocalImport { + inputs: vec![InterfaceType::I32], + outputs: vec![InterfaceType::I32], + function: |arguments: &[InterfaceValue]| { + let _size: i32 = (&arguments[0]).try_into().unwrap(); + + Ok(vec![InterfaceValue::I32(0)]) + }, + }, + ); hashmap }, diff --git a/lib/interface-types/src/interpreter/instructions/string_to_memory.rs b/lib/interface-types/src/interpreter/instructions/string_to_memory.rs new file mode 100644 index 000000000..57414d03f --- /dev/null +++ b/lib/interface-types/src/interpreter/instructions/string_to_memory.rs @@ -0,0 +1,169 @@ +use crate::interpreter::wasm::{ + structures::{FunctionIndex, TypedIndex}, + values::{InterfaceType, InterfaceValue}, +}; +use std::convert::TryInto; + +executable_instruction!( + string_to_memory(allocator_index: u32, instruction_name: String) -> _ { + move |runtime| -> _ { + let instance = &mut runtime.wasm_instance; + let index = FunctionIndex::new(allocator_index as usize); + + let allocator = instance.local_or_import(index).ok_or_else(|| { + format!( + "`{}` failed because the function `{}` (the allocator) doesn't exist.", + instruction_name, + allocator_index + ) + })?; + + if allocator.inputs() != [InterfaceType::I32] || allocator.outputs() != [InterfaceType::I32] { + return Err(format!( + "`{}` failed because the allocator `{}` has an invalid signature (expects [I32] -> [I32]).", + instruction_name, + allocator_index, + )); + } + + let string = runtime.stack.pop1().ok_or_else(|| { + format!( + "`{}` cannot call the allocator `{}` because there is not enough data on the stack for the arguments (needs {}).", + instruction_name, + allocator_index, + 1 + ) + })?; + + let string: String = (&string).try_into()?; + let string_bytes = string.as_bytes(); + let string_length = (string_bytes.len() as i32) + .try_into() + .map_err(|error| format!("{}", error))?; + + let outputs = allocator.call(&[InterfaceValue::I32(string_length)]).map_err(|_| format!( + "`{}` failed when calling the allocator `{}`.", + instruction_name, + allocator_index, + ))?; + + let string_pointer: i32 = (&outputs[0]).try_into()?; + + let memory_view = instance + .memory(0) + .ok_or_else(|| { + format!( + "`{}` failed because there is no memory to write into.", + instruction_name + ) + })? + .view(); + + for (nth, byte) in string_bytes.iter().enumerate() { + memory_view[string_pointer as usize + nth].set(*byte); + } + + runtime.stack.push(InterfaceValue::I32(string_pointer)); + runtime.stack.push(InterfaceValue::I32(string_length)); + + Ok(()) + } + } +); + +#[cfg(test)] +mod tests { + test_executable_instruction!( + test_string_to_memory = + instructions: [ + Instruction::ArgumentGet { index: 0 }, + Instruction::StringToMemory { allocator_index: 43 }, + ], + invocation_inputs: [InterfaceValue::String("Hello, World!".into())], + instance: Instance::new(), + stack: [ + InterfaceValue::I32(0), + // ^^^^^^ pointer + InterfaceValue::I32(13), + // ^^^^^^^ length + ] + ); + + test_executable_instruction!( + test_string_to_memory__roundtrip_with_memory_to_string = + instructions: [ + Instruction::ArgumentGet { index: 0 }, + Instruction::StringToMemory { allocator_index: 43 }, + Instruction::MemoryToString, + ], + invocation_inputs: [InterfaceValue::String("Hello, World!".into())], + instance: Instance::new(), + stack: [InterfaceValue::String("Hello, World!".into())], + ); + + test_executable_instruction!( + test_string_to_memory__allocator_does_not_exist = + instructions: [Instruction::StringToMemory { allocator_index: 43 }], + invocation_inputs: [], + instance: Instance { ..Default::default() }, + error: r#"`string-to-memory 43` failed because the function `43` (the allocator) doesn't exist."#, + ); + + test_executable_instruction!( + test_string_to_memory__stack_is_too_small = + instructions: [ + Instruction::StringToMemory { allocator_index: 43 } + // ^^ `43` expects 1 value on the stack, none is present + ], + invocation_inputs: [InterfaceValue::String("Hello, World!".into())], + instance: Instance::new(), + error: r#"`string-to-memory 43` cannot call the allocator `43` because there is not enough data on the stack for the arguments (needs 1)."#, + ); + + test_executable_instruction!( + test_string_to_memory__failure_when_calling_the_allocator = + instructions: [ + Instruction::ArgumentGet { index: 0 }, + Instruction::StringToMemory { allocator_index: 153 } + ], + invocation_inputs: [InterfaceValue::String("Hello, World!".into())], + instance: { + let mut instance = Instance::new(); + instance.locals_or_imports.insert( + 153, + LocalImport { + inputs: vec![InterfaceType::I32], + outputs: vec![InterfaceType::I32], + function: |_| Err(()), + // ^^^^^^^ function fails + }, + ); + + instance + }, + error: r#"`string-to-memory 153` failed when calling the allocator `153`."#, + ); + + test_executable_instruction!( + test_string_to_memory__invalid_allocator_signature = + instructions: [ + Instruction::ArgumentGet { index: 0 }, + Instruction::StringToMemory { allocator_index: 153 } + ], + invocation_inputs: [InterfaceValue::String("Hello, World!".into())], + instance: { + let mut instance = Instance::new(); + instance.locals_or_imports.insert( + 153, + LocalImport { + inputs: vec![InterfaceType::I32, InterfaceType::I32], + outputs: vec![], + function: |_| Err(()), + }, + ); + + instance + }, + error: r#"`string-to-memory 153` failed because the allocator `153` has an invalid signature (expects [I32] -> [I32])."#, + ); +} diff --git a/lib/interface-types/src/interpreter/instructions/write_utf8.rs b/lib/interface-types/src/interpreter/instructions/write_utf8.rs deleted file mode 100644 index a1e21509f..000000000 --- a/lib/interface-types/src/interpreter/instructions/write_utf8.rs +++ /dev/null @@ -1,169 +0,0 @@ -use crate::interpreter::wasm::values::{InterfaceType, InterfaceValue}; -use std::convert::TryInto; - -executable_instruction!( - write_utf8(allocator_name: String, instruction_name: String) -> _ { - move |runtime| -> _ { - let instance = &mut runtime.wasm_instance; - - match instance.export(&allocator_name) { - Some(allocator) => { - if allocator.inputs() != [InterfaceType::I32] || - allocator.outputs() != [InterfaceType::I32] { - return Err(format!( - "`{}` failed because the allocator `{}` has an invalid signature (expects [I32] -> [I32]).", - instruction_name, - allocator_name, - )) - } - - match instance.memory(0) { - Some(memory) => match runtime.stack.pop1() { - Some(string) => { - let memory_view = memory.view(); - - let string: String = (&string).try_into()?; - let string_bytes = string.as_bytes(); - let string_length = (string_bytes.len() as i32) - .try_into() - .map_err(|error| format!("{}", error))?; - - match allocator.call(&[InterfaceValue::I32(string_length)]) { - Ok(outputs) => { - let string_pointer: i32 = (&outputs[0]).try_into()?; - - for (nth, byte) in string_bytes.iter().enumerate() { - memory_view[string_pointer as usize + nth].set(*byte); - } - - runtime.stack.push(InterfaceValue::I32(string_pointer)); - runtime.stack.push(InterfaceValue::I32(string_length)); - - Ok(()) - } - Err(_) => Err(format!( - "`{}` failed when calling the allocator `{}`.", - instruction_name, - allocator_name, - )) - } - } - None => Err(format!( - "`{}` cannot call the allocator `{}` because there is not enough data on the stack for the arguments (needs {}).", - instruction_name, - allocator_name, - 1 - )) - } - None => Err(format!( - "`{}` failed because there is no memory to write into.", - instruction_name - )) - } - } - None => Err(format!( - "`{}` failed because the exported function `{}` (the allocator) doesn't exist.", - instruction_name, - allocator_name - )) - } - } - } -); - -#[cfg(test)] -mod tests { - test_executable_instruction!( - test_write_utf8 = - instructions: [ - Instruction::ArgumentGet { index: 0 }, - Instruction::WriteUtf8 { allocator_name: "alloc" }, - ], - invocation_inputs: [InterfaceValue::String("Hello, World!".into())], - instance: Instance::new(), - stack: [ - InterfaceValue::I32(0), - // ^^^^^^ pointer - InterfaceValue::I32(13), - // ^^^^^^^ length - ] - ); - - test_executable_instruction!( - test_write_utf8__roundtrip_with_read_utf8 = - instructions: [ - Instruction::ArgumentGet { index: 0 }, - Instruction::WriteUtf8 { allocator_name: "alloc" }, - Instruction::ReadUtf8, - ], - invocation_inputs: [InterfaceValue::String("Hello, World!".into())], - instance: Instance::new(), - stack: [InterfaceValue::String("Hello, World!".into())], - ); - - test_executable_instruction!( - test_write_utf8__allocator_does_not_exist = - instructions: [Instruction::WriteUtf8 { allocator_name: "alloc" }], - invocation_inputs: [], - instance: Instance { ..Default::default() }, - error: r#"`write-utf8 "alloc"` failed because the exported function `alloc` (the allocator) doesn't exist."#, - ); - - test_executable_instruction!( - test_write_utf8__stack_is_too_small = - instructions: [ - Instruction::WriteUtf8 { allocator_name: "alloc" } - // ^^^^^ `alloc` expects 1 value on the stack, none is present - ], - invocation_inputs: [InterfaceValue::String("Hello, World!".into())], - instance: Instance::new(), - error: r#"`write-utf8 "alloc"` cannot call the allocator `alloc` because there is not enough data on the stack for the arguments (needs 1)."#, - ); - - test_executable_instruction!( - test_write_utf8__failure_when_calling_the_allocator = - instructions: [ - Instruction::ArgumentGet { index: 0 }, - Instruction::WriteUtf8 { allocator_name: "alloc-fail" } - ], - invocation_inputs: [InterfaceValue::String("Hello, World!".into())], - instance: { - let mut instance = Instance::new(); - instance.exports.insert( - "alloc-fail".into(), - Export { - inputs: vec![InterfaceType::I32], - outputs: vec![InterfaceType::I32], - function: |_| Err(()), - // ^^^^^^^ function fails - }, - ); - - instance - }, - error: r#"`write-utf8 "alloc-fail"` failed when calling the allocator `alloc-fail`."#, - ); - - test_executable_instruction!( - test_write_utf8__invalid_allocator_signature = - instructions: [ - Instruction::ArgumentGet { index: 0 }, - Instruction::WriteUtf8 { allocator_name: "alloc-fail" } - ], - invocation_inputs: [InterfaceValue::String("Hello, World!".into())], - instance: { - let mut instance = Instance::new(); - instance.exports.insert( - "alloc-fail".into(), - Export { - inputs: vec![InterfaceType::I32, InterfaceType::I32], - outputs: vec![], - function: |_| Err(()), - }, - ); - - instance - }, - error: r#"`write-utf8 "alloc-fail"` failed because the allocator `alloc-fail` has an invalid signature (expects [I32] -> [I32])."#, - ); -} diff --git a/lib/interface-types/src/interpreter/mod.rs b/lib/interface-types/src/interpreter/mod.rs index 1cfe66531..bdc939fe2 100644 --- a/lib/interface-types/src/interpreter/mod.rs +++ b/lib/interface-types/src/interpreter/mod.rs @@ -71,7 +71,7 @@ pub(crate) type ExecutableInstruction = (&vec![ /// Instruction::ArgumentGet { index: 1 }, /// Instruction::ArgumentGet { index: 0 }, -/// Instruction::CallExport { export_name: "sum" }, +/// Instruction::CallCore { function_index: 42 }, /// ]) /// .try_into() /// .unwrap(); @@ -81,12 +81,12 @@ pub(crate) type ExecutableInstruction i32 { a + b }`. -/// exports: { +/// // 3.1. Defines one function: `fn sum(a: i32, b: i32) -> i32 { a + b }`. +/// locals_or_imports: { /// let mut hashmap = HashMap::new(); /// hashmap.insert( -/// "sum".into(), -/// Export { +/// 42, +/// LocalImport { /// // Defines the argument types of the function. /// inputs: vec![InterfaceType::I32, InterfaceType::I32], /// @@ -174,8 +174,7 @@ where } /// Transforms a `Vec` into an `Interpreter`. -impl<'binary_input, Instance, Export, LocalImport, Memory, MemoryView> - TryFrom<&Vec>> +impl TryFrom<&Vec> for Interpreter where Export: wasm::structures::Export, @@ -196,15 +195,12 @@ where Instruction::ArgumentGet { index } => { instructions::argument_get(*index, instruction_name) } - Instruction::Call { function_index } => { - instructions::call(*function_index, instruction_name) + Instruction::CallCore { function_index } => { + instructions::call_core(*function_index, instruction_name) } - Instruction::CallExport { export_name } => { - instructions::call_export((*export_name).to_owned(), instruction_name) - } - Instruction::ReadUtf8 => instructions::read_utf8(instruction_name), - Instruction::WriteUtf8 { allocator_name } => { - instructions::write_utf8((*allocator_name).to_owned(), instruction_name) + Instruction::MemoryToString => instructions::memory_to_string(instruction_name), + Instruction::StringToMemory { allocator_index } => { + instructions::string_to_memory(*allocator_index, instruction_name) } Instruction::I32ToS8 => instructions::i32_to_s8(), @@ -253,24 +249,3 @@ where }) } } - -#[cfg(test)] -mod tests { - use super::{wasm::structures::EmptyMemoryView, Instruction, Interpreter}; - use std::convert::TryInto; - - #[test] - fn test_interpreter_from_instructions() { - let instructions = vec![ - Instruction::ArgumentGet { index: 0 }, - Instruction::ArgumentGet { index: 0 }, - Instruction::CallExport { export_name: "foo" }, - Instruction::ReadUtf8, - Instruction::Call { function_index: 7 }, - ]; - let interpreter: Interpreter<(), (), (), (), EmptyMemoryView> = - (&instructions).try_into().unwrap(); - - assert_eq!(interpreter.executable_instructions.len(), 5); - } -} diff --git a/lib/llvm-backend-tests/Cargo.toml b/lib/llvm-backend-tests/Cargo.toml index 4a5e7e80c..6bb843be5 100644 --- a/lib/llvm-backend-tests/Cargo.toml +++ b/lib/llvm-backend-tests/Cargo.toml @@ -9,8 +9,8 @@ edition = "2018" [dependencies] wabt = "0.9.1" -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } -wasmer-runtime = { path = "../runtime", version = "0.15.0" } -wasmer-llvm-backend = { path = "../llvm-backend", version = "0.15.0", features = ["test"] } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } +wasmer-runtime = { path = "../runtime", version = "0.16.0" } +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.0", features = ["test"] } [features] diff --git a/lib/llvm-backend/Cargo.toml b/lib/llvm-backend/Cargo.toml index cfe2834a8..fa3d05b22 100644 --- a/lib/llvm-backend/Cargo.toml +++ b/lib/llvm-backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-llvm-backend" -version = "0.15.0" +version = "0.16.0" license = "MIT" authors = ["The Wasmer Engineering Team "] repository = "https://github.com/wasmerio/wasmer" @@ -10,7 +10,7 @@ edition = "2018" readme = "README.md" [dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0", features = ["generate-debug-information-no-export-symbols"] } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0", features = ["generate-debug-information-no-export-symbols"] } wasmparser = "0.51.3" smallvec = "0.6" goblin = "0.0.24" diff --git a/lib/middleware-common-tests/Cargo.toml b/lib/middleware-common-tests/Cargo.toml index f83da0256..943da23a0 100644 --- a/lib/middleware-common-tests/Cargo.toml +++ b/lib/middleware-common-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middleware-common-tests" -version = "0.15.0" +version = "0.16.0" authors = ["The Wasmer Engineering Team "] edition = "2018" repository = "https://github.com/wasmerio/wasmer" @@ -8,11 +8,11 @@ license = "MIT" publish = false [dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } -wasmer-middleware-common = { path = "../middleware-common", version = "0.15.0" } -wasmer-clif-backend = { path = "../clif-backend", version = "0.15.0", optional = true } -wasmer-llvm-backend = { path = "../llvm-backend", version = "0.15.0", features = ["test"], optional = true } -wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.15.0", optional = true } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } +wasmer-middleware-common = { path = "../middleware-common", version = "0.16.0" } +wasmer-clif-backend = { path = "../clif-backend", version = "0.16.0", optional = true } +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.0", features = ["test"], optional = true } +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.0", optional = true } [features] clif = ["wasmer-clif-backend"] diff --git a/lib/middleware-common/Cargo.toml b/lib/middleware-common/Cargo.toml index c44fba176..ea39f5958 100644 --- a/lib/middleware-common/Cargo.toml +++ b/lib/middleware-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-middleware-common" -version = "0.15.0" +version = "0.16.0" repository = "https://github.com/wasmerio/wasmer" description = "Wasmer runtime common middlewares" license = "MIT" @@ -10,4 +10,4 @@ categories = ["wasm"] edition = "2018" [dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } diff --git a/lib/runtime-c-api/Cargo.toml b/lib/runtime-c-api/Cargo.toml index 38c099375..fb933aa2f 100644 --- a/lib/runtime-c-api/Cargo.toml +++ b/lib/runtime-c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-runtime-c-api" -version = "0.15.0" +version = "0.16.0" description = "Wasmer C API library" documentation = "https://wasmerio.github.io/wasmer/c/runtime-c-api/" license = "MIT" @@ -20,22 +20,22 @@ libc = "0.2.60" [dependencies.wasmer-runtime] default-features = false path = "../runtime" -version = "0.15.0" +version = "0.16.0" [dependencies.wasmer-runtime-core] default-features = false path = "../runtime-core" -version = "0.15.0" +version = "0.16.0" [dependencies.wasmer-wasi] default-features = false path = "../wasi" -version = "0.15.0" +version = "0.16.0" optional = true [dependencies.wasmer-emscripten] path = "../emscripten" -version = "0.15.0" +version = "0.16.0" optional = true [features] diff --git a/lib/runtime-core-tests/Cargo.toml b/lib/runtime-core-tests/Cargo.toml index a97b44b08..1e5b58f27 100644 --- a/lib/runtime-core-tests/Cargo.toml +++ b/lib/runtime-core-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-runtime-core-tests" -version = "0.15.0" +version = "0.16.0" description = "Tests for the Wasmer runtime core crate" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -9,10 +9,10 @@ publish = false [dependencies] wabt = "0.9.1" -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } -wasmer-clif-backend = { path = "../clif-backend", version = "0.15.0", optional = true } -wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.15.0", optional = true } -wasmer-llvm-backend = { path = "../llvm-backend", version = "0.15.0", features = ["test"], optional = true } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } +wasmer-clif-backend = { path = "../clif-backend", version = "0.16.0", optional = true } +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.0", optional = true } +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.0", features = ["test"], optional = true } [features] default = ["backend-cranelift"] diff --git a/lib/runtime-core/Cargo.toml b/lib/runtime-core/Cargo.toml index b309a552d..03904ed7c 100644 --- a/lib/runtime-core/Cargo.toml +++ b/lib/runtime-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-runtime-core" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime core library" license = "MIT" authors = ["The Wasmer Engineering Team "] diff --git a/lib/runtime/Cargo.toml b/lib/runtime/Cargo.toml index f836c9693..bc9b1fe3a 100644 --- a/lib/runtime/Cargo.toml +++ b/lib/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-runtime" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime library" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -11,17 +11,17 @@ edition = "2018" readme = "README.md" [dependencies] -wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.15.0", optional = true } +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.0", optional = true } lazy_static = "1.4" memmap = "0.7" [dependencies.wasmer-runtime-core] path = "../runtime-core" -version = "0.15.0" +version = "0.16.0" [dependencies.wasmer-clif-backend] path = "../clif-backend" -version = "0.15.0" +version = "0.16.0" optional = true # Dependencies for caching. diff --git a/lib/singlepass-backend/Cargo.toml b/lib/singlepass-backend/Cargo.toml index b1964dc3d..2f3937f3b 100644 --- a/lib/singlepass-backend/Cargo.toml +++ b/lib/singlepass-backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-singlepass-backend" -version = "0.15.0" +version = "0.16.0" repository = "https://github.com/wasmerio/wasmer" description = "Wasmer runtime single pass compiler backend" license = "MIT" @@ -11,7 +11,7 @@ edition = "2018" readme = "README.md" [dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } dynasm = "0.5" dynasmrt = "0.5" lazy_static = "1.4" diff --git a/lib/spectests/Cargo.toml b/lib/spectests/Cargo.toml index c5497c476..aed07d65c 100644 --- a/lib/spectests/Cargo.toml +++ b/lib/spectests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-spectests" -version = "0.15.0" +version = "0.16.0" description = "Wasmer spectests library" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -9,10 +9,10 @@ edition = "2018" [dependencies] glob = "0.3" -wasmer-runtime = { path = "../runtime", version = "0.15.0", default-features = false} -wasmer-clif-backend = { path = "../clif-backend", version = "0.15.0", optional = true} -wasmer-llvm-backend = { path = "../llvm-backend", version = "0.15.0", features = ["test"], optional = true } -wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.15.0", optional = true } +wasmer-runtime = { path = "../runtime", version = "0.16.0", default-features = false} +wasmer-clif-backend = { path = "../clif-backend", version = "0.16.0", optional = true} +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.0", features = ["test"], optional = true } +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.0", optional = true } [build-dependencies] wabt = "0.9.1" diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index 32c8e266b..a64b3046a 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-experimental-io-devices" -version = "0.15.0" +version = "0.16.0" authors = ["The Wasmer Engineering Team "] edition = "2018" repository = "https://github.com/wasmerio/wasmer" @@ -14,8 +14,8 @@ maintenance = { status = "experimental" } [dependencies] log = "0.4" minifb = "0.13" -wasmer-wasi = { version = "0.15.0", path = "../wasi" } -wasmer-runtime-core = { version = "0.15.0", path = "../runtime-core" } +wasmer-wasi = { version = "0.16.0", path = "../wasi" } +wasmer-runtime-core = { version = "0.16.0", path = "../runtime-core" } ref_thread_local = "0.0" serde = "1" typetag = "0.1" diff --git a/lib/wasi-tests/Cargo.toml b/lib/wasi-tests/Cargo.toml index c7208be5d..19b6c1e88 100644 --- a/lib/wasi-tests/Cargo.toml +++ b/lib/wasi-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi-tests" -version = "0.15.0" +version = "0.16.0" description = "Tests for our WASI implementation" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -10,18 +10,18 @@ build = "build/mod.rs" [dependencies] # We set default features to false to be able to use the singlepass backend properly -wasmer-runtime = { path = "../runtime", version = "0.15.0", default-features = false } -wasmer-wasi = { path = "../wasi", version = "0.15.0" } +wasmer-runtime = { path = "../runtime", version = "0.16.0", default-features = false } +wasmer-wasi = { path = "../wasi", version = "0.16.0" } # hack to get tests to work -wasmer-clif-backend = { path = "../clif-backend", version = "0.15.0", optional = true} -wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.15.0", optional = true } -wasmer-llvm-backend = { path = "../llvm-backend", version = "0.15.0", features = ["test"], optional = true } +wasmer-clif-backend = { path = "../clif-backend", version = "0.16.0", optional = true} +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.16.0", optional = true } +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.16.0", features = ["test"], optional = true } [build-dependencies] glob = "0.3" [dev-dependencies] -wasmer-dev-utils = { path = "../dev-utils", version = "0.15.0"} +wasmer-dev-utils = { path = "../dev-utils", version = "0.16.0"} [features] clif = ["wasmer-clif-backend", "wasmer-runtime/default-backend-cranelift"] diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index 35886c948..13495fd12 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-wasi" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime WASI implementation library" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -19,7 +19,7 @@ getrandom = "0.1" time = "0.1" typetag = "0.1" serde = { version = "1", features = ["derive"] } -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } [target.'cfg(windows)'.dependencies] winapi = "0.3" diff --git a/lib/win-exception-handler/Cargo.toml b/lib/win-exception-handler/Cargo.toml index 0a92ae94b..7c5faacac 100644 --- a/lib/win-exception-handler/Cargo.toml +++ b/lib/win-exception-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-win-exception-handler" -version = "0.15.0" +version = "0.16.0" description = "Wasmer runtime exception handling for Windows" license = "MIT" authors = ["The Wasmer Engineering Team "] @@ -8,7 +8,7 @@ repository = "https://github.com/wasmerio/wasmer" edition = "2018" [target.'cfg(windows)'.dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.15.0" } +wasmer-runtime-core = { path = "../runtime-core", version = "0.16.0" } winapi = { version = "0.3.8", features = ["winbase", "errhandlingapi", "minwindef", "minwinbase", "winnt"] } libc = "0.2.60" diff --git a/scripts/update_version_numbers.sh b/scripts/update_version_numbers.sh index 77392a5a3..ed93c6bde 100755 --- a/scripts/update_version_numbers.sh +++ b/scripts/update_version_numbers.sh @@ -1,5 +1,5 @@ -PREVIOUS_VERSION='0.14.1' -NEXT_VERSION='0.15.0' +PREVIOUS_VERSION='0.15.0' +NEXT_VERSION='0.16.0' # quick hack fd Cargo.toml --exec sed -i '' "s/version = \"$PREVIOUS_VERSION\"/version = \"$NEXT_VERSION\"/" diff --git a/src/installer/media/wizard_logo.ico b/src/installer/media/wizard_logo.ico index 664b0d7a1..80d69b055 100644 Binary files a/src/installer/media/wizard_logo.ico and b/src/installer/media/wizard_logo.ico differ diff --git a/src/installer/media/wizard_logo_2.bmp b/src/installer/media/wizard_logo_2.bmp index 959d76829..91c93bac3 100644 Binary files a/src/installer/media/wizard_logo_2.bmp and b/src/installer/media/wizard_logo_2.bmp differ diff --git a/src/installer/media/wizard_logo_small.bmp b/src/installer/media/wizard_logo_small.bmp index 9ca204fca..03d6e4dec 100644 Binary files a/src/installer/media/wizard_logo_small.bmp and b/src/installer/media/wizard_logo_small.bmp differ diff --git a/src/installer/wasmer.iss b/src/installer/wasmer.iss index 408a92e39..89826ab5e 100644 --- a/src/installer/wasmer.iss +++ b/src/installer/wasmer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Wasmer -AppVersion=0.15.0 +AppVersion=0.16.0 DefaultDirName={pf}\Wasmer DefaultGroupName=Wasmer Compression=lzma2 @@ -23,6 +23,7 @@ Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "WASMER_CACHE_DI [Files] Source: "..\..\target\release\wasmer.exe"; DestDir: "{app}\bin" Source: "..\..\wapm-cli\target\release\wapm.exe"; DestDir: "{app}\bin" +Source: "wax.cmd"; DestDir: "{app}\bin" [Dirs] Name: "{%USERPROFILE}\.wasmer" diff --git a/src/installer/wax.cmd b/src/installer/wax.cmd new file mode 100644 index 000000000..efe9eaffb --- /dev/null +++ b/src/installer/wax.cmd @@ -0,0 +1,2 @@ +@echo off +wapm.exe execute %*