From ab4c8d069bd6cbb39f89494a82bc62267e28903a Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 31 May 2021 17:06:26 +0200 Subject: [PATCH] chore: Removing the `deprecated` crates. --- Cargo.toml | 3 - Makefile | 7 +- lib/deprecated/README.md | 35 - lib/deprecated/runtime-core/CHANGES.md | 739 --------- lib/deprecated/runtime-core/Cargo.lock | 1453 ---------------- lib/deprecated/runtime-core/Cargo.toml | 40 - lib/deprecated/runtime-core/README.md | 48 - lib/deprecated/runtime-core/build.rs | 29 - .../runtime-core/doc/new-api/artifact.rs | 8 - .../runtime-core/doc/new-api/bytes.rs | 1 - .../runtime-core/doc/new-api/dynamicfunc.rs | 9 - .../runtime-core/doc/new-api/dynfunc.rs | 6 - .../doc/new-api/export_descriptor.rs | 4 - .../runtime-core/doc/new-api/exports.rs | 6 - .../runtime-core/doc/new-api/func.rs | 10 - .../runtime-core/doc/new-api/func_sig.rs | 7 - .../runtime-core/doc/new-api/global.rs | 9 - .../doc/new-api/global_descriptor.rs | 4 - .../runtime-core/doc/new-api/global_init.rs | 15 - .../runtime-core/doc/new-api/host_function.rs | 3 - .../doc/new-api/import_descriptor.rs | 5 - .../runtime-core/doc/new-api/import_object.rs | 11 - .../runtime-core/doc/new-api/instance.rs | 14 - .../runtime-core/doc/new-api/memory.rs | 9 - .../doc/new-api/memory_descriptor.rs | 5 - .../runtime-core/doc/new-api/memory_type.rs | 4 - .../runtime-core/doc/new-api/memory_view.rs | 5 - .../runtime-core/doc/new-api/module.rs | 10 - .../runtime-core/doc/new-api/module_info.rs | 23 - .../runtime-core/doc/new-api/namespace.rs | 7 - .../doc/new-api/native_wasm_type.rs | 10 - .../runtime-core/doc/new-api/pages.rs | 7 - .../runtime-core/doc/new-api/table.rs | 10 - .../doc/new-api/table_descriptor.rs | 9 - .../doc/new-api/wasm_extern_type.rs | 6 - .../doc/new-api/wasm_type_list.rs | 12 - .../runtime-core/doc/new-api/wasmhash.rs | 7 - .../runtime-core/doc/old-api/artifact.rs | 7 - .../runtime-core/doc/old-api/bytes.rs | 1 - .../runtime-core/doc/old-api/dynamicfunc.rs | 5 - .../runtime-core/doc/old-api/dynfunc.rs | 7 - .../doc/old-api/export_descriptor.rs | 4 - .../runtime-core/doc/old-api/exports.rs | 6 - .../runtime-core/doc/old-api/func.rs | 9 - .../runtime-core/doc/old-api/func_sig.rs | 8 - .../runtime-core/doc/old-api/global.rs | 9 - .../doc/old-api/global_descriptor.rs | 4 - .../runtime-core/doc/old-api/global_init.rs | 4 - .../runtime-core/doc/old-api/host_function.rs | 3 - .../doc/old-api/import_descriptor.rs | 5 - .../runtime-core/doc/old-api/import_object.rs | 12 - .../runtime-core/doc/old-api/instance.rs | 18 - .../runtime-core/doc/old-api/memory.rs | 9 - .../doc/old-api/memory_descriptor.rs | 6 - .../runtime-core/doc/old-api/memory_type.rs | 5 - .../runtime-core/doc/old-api/memory_view.rs | 5 - .../runtime-core/doc/old-api/module.rs | 10 - .../runtime-core/doc/old-api/module_info.rs | 21 - .../runtime-core/doc/old-api/namespace.rs | 7 - .../doc/old-api/native_wasm_type.rs | 6 - .../runtime-core/doc/old-api/pages.rs | 6 - .../runtime-core/doc/old-api/table.rs | 10 - .../doc/old-api/table_descriptor.rs | 5 - .../doc/old-api/wasm_extern_type.rs | 6 - .../doc/old-api/wasm_type_list.rs | 11 - .../runtime-core/doc/old-api/wasmhash.rs | 7 - lib/deprecated/runtime-core/doc/review.sh | 10 - lib/deprecated/runtime-core/src/backend.rs | 84 - lib/deprecated/runtime-core/src/cache.rs | 94 -- lib/deprecated/runtime-core/src/error.rs | 3 - lib/deprecated/runtime-core/src/export.rs | 4 - .../runtime-core/src/functional_api.rs | 105 -- lib/deprecated/runtime-core/src/global.rs | 109 -- lib/deprecated/runtime-core/src/import.rs | 159 -- lib/deprecated/runtime-core/src/instance.rs | 271 --- lib/deprecated/runtime-core/src/lib.rs | 170 -- lib/deprecated/runtime-core/src/memory.rs | 143 -- lib/deprecated/runtime-core/src/module.rs | 249 --- lib/deprecated/runtime-core/src/structures.rs | 1 - lib/deprecated/runtime-core/src/table.rs | 112 -- lib/deprecated/runtime-core/src/typed_func.rs | 420 ----- lib/deprecated/runtime-core/src/types.rs | 99 -- lib/deprecated/runtime-core/src/units.rs | 10 - lib/deprecated/runtime-core/src/vm.rs | 92 -- lib/deprecated/runtime/.empty | 0 lib/deprecated/runtime/Cargo.lock | 1460 ----------------- lib/deprecated/runtime/Cargo.toml | 26 - lib/deprecated/runtime/README.md | 125 -- lib/deprecated/runtime/examples/call.rs | 63 - lib/deprecated/runtime/examples/readme.rs | 29 - lib/deprecated/runtime/src/lib.rs | 159 -- 91 files changed, 1 insertion(+), 6802 deletions(-) delete mode 100644 lib/deprecated/README.md delete mode 100644 lib/deprecated/runtime-core/CHANGES.md delete mode 100644 lib/deprecated/runtime-core/Cargo.lock delete mode 100644 lib/deprecated/runtime-core/Cargo.toml delete mode 100644 lib/deprecated/runtime-core/README.md delete mode 100644 lib/deprecated/runtime-core/build.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/artifact.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/bytes.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/dynamicfunc.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/dynfunc.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/export_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/exports.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/func.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/func_sig.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/global.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/global_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/global_init.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/host_function.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/import_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/import_object.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/instance.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/memory.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/memory_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/memory_type.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/memory_view.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/module.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/module_info.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/namespace.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/native_wasm_type.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/pages.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/table.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/table_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/wasm_extern_type.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/wasm_type_list.rs delete mode 100644 lib/deprecated/runtime-core/doc/new-api/wasmhash.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/artifact.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/bytes.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/dynamicfunc.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/dynfunc.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/export_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/exports.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/func.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/func_sig.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/global.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/global_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/global_init.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/host_function.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/import_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/import_object.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/instance.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/memory.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/memory_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/memory_type.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/memory_view.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/module.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/module_info.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/namespace.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/native_wasm_type.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/pages.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/table.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/table_descriptor.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/wasm_extern_type.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/wasm_type_list.rs delete mode 100644 lib/deprecated/runtime-core/doc/old-api/wasmhash.rs delete mode 100755 lib/deprecated/runtime-core/doc/review.sh delete mode 100644 lib/deprecated/runtime-core/src/backend.rs delete mode 100644 lib/deprecated/runtime-core/src/cache.rs delete mode 100644 lib/deprecated/runtime-core/src/error.rs delete mode 100644 lib/deprecated/runtime-core/src/export.rs delete mode 100644 lib/deprecated/runtime-core/src/functional_api.rs delete mode 100644 lib/deprecated/runtime-core/src/global.rs delete mode 100644 lib/deprecated/runtime-core/src/import.rs delete mode 100644 lib/deprecated/runtime-core/src/instance.rs delete mode 100644 lib/deprecated/runtime-core/src/lib.rs delete mode 100644 lib/deprecated/runtime-core/src/memory.rs delete mode 100644 lib/deprecated/runtime-core/src/module.rs delete mode 100644 lib/deprecated/runtime-core/src/structures.rs delete mode 100644 lib/deprecated/runtime-core/src/table.rs delete mode 100644 lib/deprecated/runtime-core/src/typed_func.rs delete mode 100644 lib/deprecated/runtime-core/src/types.rs delete mode 100644 lib/deprecated/runtime-core/src/units.rs delete mode 100644 lib/deprecated/runtime-core/src/vm.rs delete mode 100644 lib/deprecated/runtime/.empty delete mode 100644 lib/deprecated/runtime/Cargo.lock delete mode 100644 lib/deprecated/runtime/Cargo.toml delete mode 100644 lib/deprecated/runtime/README.md delete mode 100644 lib/deprecated/runtime/examples/call.rs delete mode 100644 lib/deprecated/runtime/examples/readme.rs delete mode 100644 lib/deprecated/runtime/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 93eab4f6d98..ba2a4109d90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,9 +53,6 @@ members = [ "tests/integration/cli", "fuzz", ] -exclude = [ - "lib/deprecated", -] [build-dependencies] test-generator = { path = "tests/lib/test-generator" } diff --git a/Makefile b/Makefile index 6b9b1194e67..c54c26aa273 100644 --- a/Makefile +++ b/Makefile @@ -503,7 +503,7 @@ build-capi-headless-all: capi-setup # Testing # ########### -test: test-compilers test-packages test-examples test-deprecated +test: test-compilers test-packages test-examples test-compilers: cargo test --release --tests $(compiler_features) @@ -564,11 +564,6 @@ test-wasi-unit: test-examples: cargo test --release $(compiler_features) --features wasi --examples -test-deprecated: - cargo test --manifest-path lib/deprecated/runtime-core/Cargo.toml -p wasmer-runtime-core --release - cargo test --manifest-path lib/deprecated/runtime/Cargo.toml -p wasmer-runtime --release - cargo test --manifest-path lib/deprecated/runtime/Cargo.toml -p wasmer-runtime --release --examples - test-integration: cargo test -p wasmer-integration-tests-cli diff --git a/lib/deprecated/README.md b/lib/deprecated/README.md deleted file mode 100644 index 604433f4306..00000000000 --- a/lib/deprecated/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Wasmer deprecated packages - -## Deprecation notice: please read - -Thanks to users feedback, collected experience and various use cases, -Wasmer has decided to entirely improve its API to offer the best user -experience and the best features to as many users as possible. - -The new version of Wasmer (`1.0.0`) includes many improvements -in terms of performance or the memory consumption, in addition to a ton -of new features and much better flexibility! -You can check revamped new API in the [`wasmer`] crate. - -In order to help our existing users to enjoy the performance boost and -memory improvements without updating their program that much, we have -created a new version of the `wasmer-runtime` crate, which is now -*an adaptation* of the new API but with the old API syntax, as much as -possible. Indeed, it was not always possible to provide the exact same -API, but changes are subtle. - -We have carefully documented most of the differences in [the -`runtime-core/CHANGES.md` document][changes]. - -It is important to understand the public of this port. We do not -recommend to advanced users of Wasmer to use this port. Advanced API, -like `ModuleInfo` or the `vm` module (incl. `vm::Ctx`) have not been -fully ported because it was very internals to Wasmer. For advanced -users, we highly recommend to migrate to the new version of Wasmer, -which is awesome by the way (completely neutral opinion). The public -for this port is beginners or regular users that do not necesarily -have time to update their code immediately but that want to enjoy a -performance boost and memory improvements. - -[`wasmer`]: https://crates.io/crates/wasmer/ -[changes]: ./runtime-core/CHANGES.md diff --git a/lib/deprecated/runtime-core/CHANGES.md b/lib/deprecated/runtime-core/CHANGES.md deleted file mode 100644 index 361b9c5ace7..00000000000 --- a/lib/deprecated/runtime-core/CHANGES.md +++ /dev/null @@ -1,739 +0,0 @@ -# Changes between this port and the old `wasmer-runtime-core` API - -This document lists *only the differences* between the old and the new -API (the port), i.e. API that didn't change are absent. - -## Overall - -* Host function must always take a `vm::Ctx` as first parameter - -## All changes - -By type name in alphabetic order. - -### `Artifact` - -Before: - -```rust -impl Artifact { - fn deserialize(bytes: &[u8]) -> Result; -} -``` - -After: - -```rust -impl Artifact { - unsafe fn deserialize(bytes: &[u8]) -> Result; - fn module(self) -> Module; -} -``` - -The `deserialize` method is now marked as `unsafe` since it is not -checked that `bytes` represent a valid artifact. - -The new `module` method is introduced to fetch the `Module` inside the -artifact. - -### `DynamicFunc` - -Before: - -```rust -impl DynamicFunc { - fn new(signature: Arc, func: F) -> Self; -} -``` - -After: - -```rust -impl DynamicFunc { - fn new(signature: &FuncSig, func: F) -> Self; - fn signature(&self) -> &FuncSig; - fn params(&self) -> &[Type]; - fn returns(&self) -> &[Type]; - fn call(&self, params: &[Value] -> Result, RuntimeError>; -} -``` - -The constructor `new` no longer takes an `Arc` but a reference to -`FuncSig`. - -`signature`, `params`, `returns` and `call` are new -methods. Previously, it was required to convert `DynamicFunc` into -`Func` with `Into>`. Now there is no conversion possible -between the two, and `DynamicFunc` gains its own methods. - -### `DynFunc` - -Before: - -```rust -impl DynFunc { - fn raw(&self) -> *const Func; -} -``` - -After: - -```rust -impl DynFunc { -} -``` - -The `raw` method has been removed. It was present for internal -purposes only, not sure it will impact you. - -### `ExportDescriptor` - -Before: - -```rust -struct ExportDescriptor<'a> { - name: &'a str, - ty: ExternDescriptor, -} -``` - -After: - -```rust -struct ExportDescriptor { - name: String, - ty: ExternDescriptor, -} -``` - -The lifetime on `ExportDescriptor` is no longer necessary: The `name` -field now holds a `String` instead of a `&str`. - -### `Export` - -Before: - -```rust -impl Exports { - fn get<'a, T: Exportable<'a>>(&'a self, name: &str) -> Result; - fn into_iter(&self) -> ExportIter; -} -``` - -After: - -```rust -impl Exports { - fn get<'a, T: Exportable<'a> + Clone + 'a>(&'a self, name: &str) -> Result; - fn iter(&self) -> ExportsIterator>; -} -``` - -The `get` method is different. It returns a `T` where `T` implements -`Exportable<'a>` _and_ `Clone` (that the addition). The returned error -is also `ExportError` instead of `ResolveError`. - -The method `into_iter` is now `iter` and returns references to the -export name and export value. - -### `Func` - -Before: - -```rust -impl Func { - fn params(&self) -> &'static [Type]; - fn returns(&self) -> &'static [Type]; - fn get_vm_func(&self) -> NonNull; -} -``` - -After: - -```rust -impl Func { - fn params(&self) -> &[Type]; - fn returns(&self) -> &[Type]; - fn dyn_call(&self, params: &[Value]) -> Result, RuntimeError>; - fn signature(&self) -> &FuncSig; -} -``` - -The `params` and `returns` return a slice of `[Type]` which has not -the `'static` lifetime. - -The `get_vm_func` method has been removed. It was present for internal -purposes, it unlikely it will have an impact on your project. - -In addition to the `call` method, there is now a `dyn_call` method, -that calls the function with arguments packed in a slice of `Value`. - -Finally, there is a new `signature` method. - -### `FuncSig` - -Before: - -```rust -impl FuncSig { - fn returns(&self) -> &[Type]; - fn check_param_value_types(&self, params: &[Value]) -> bool; -} -``` - -After: - -```rust -impl FuncSig { - fn results(&self) -> &[Type]; -} -``` - -The `returns` method has been renamed `results`. - -The `check_param_value_types` method has been removed, since it is now -possible to compare two `Vec`. - -### `GlobalInit` - -`GlobalInit` has totally changed. It was a `struct`, now it's an -`enum`: - -```rust -enum GlobalInit { - I32Const(i32), - I64Const(i64), - F32Const(f32), - F64Const(f64), - V128Const(V128), - GetGlobal(GlobalIndex), - RefNullConst, - RefFunc(FunctionIndex), -} - -impl GlobalInit { - fn from_value(value: Value) -> Self; - fn to_value(&self) -> Value; -} -``` - -### `HostFunction` - -Before: - -```rust -trait HostFunction { - fn to_raw(self) -> (NonNull, Option>); -} -``` - -After: - -```rust -trait HostFunction { - fn function_body_ptr(self) -> *const VMFunctionBody; -} -``` - -The generic parameters of the `HostFunction` trait has been re-ordered -and a new one has been introduced: `T`. In the new API, it represents -the type of the environment; in this port, it should not be used (or -at worst, use `vm::Ctx`). - -The `to_raw` method, aimed at internal using, has been replaced by -`function_body_ptr`. It is subject to another change, so please don't -use it. - -### `ImportDescriptor` - -Before: - -```rust -struct ImportDescriptor { - namespace: String, -} -``` - -After: - -```rust -struct ImportDescriptor { - module: String, -} -``` - -The `namespace` field has been renamed `module`. - -### `ImportObject` - -Before: - -```rust -impl ImportObject { - fn with_namespace(&self, namespace: &str, f: Func) -> Option; - fn maybe_with_namespace(&self, namespace: &str, f: Func) -> Option; -} -``` - -After: - -```rust -impl ImportObject { - fn call_state_creator(&self) -> Option<(*mut c_void, fn(*mut c_void))>; - fn get_export(&self, module: &str, name: &str) -> Option; - fn clone_ref(&self) -> Self; -} -``` - -The `with_namespace` and `maybe_with_namespace` methods have been -removed. - -The `call_state_creator` method is new, along with `get_export` and -`clone_ref`. - -The `Extend<(String, String, Export)>` implementation and `extend` method -have been removed. Namespaces must now be final when `register`ed. - -### `Instance` - -Before: - -```rust -struct Instance { - module: Arc, - exports: Exports, -} - -impl Instance { - fn load(&self, loader: T) -> Result; - fn func(&self, name: &str) -> ResolveResult>; - fn resolve_func(&self, name: &str) -> ResolveResult; - fn dyn_func(&self, name: &str) -> ResolveResult; - fn call(&self, name: &str, params: &[Value]) -> CallResult>; - fn context(&self) -> &Ctx; - fn context_mut(&mut self) -> &mut Ctx; - fn exports(&self) -> ExportsIter; - fn get_internal(&self, fields: &InternalField) -> u64; - fn set_internal(&self, fields: &InternalField, value: u64); -} -``` - -After: - -```rust -struct Instance { - exports: Exports, -} - -impl Instance { - fn func(&self, name: &str) -> Result, ExportError>; - fn resolve_func(&self, name: &str) -> Result; - fn dyn_func(&self, name: &str) -> Result; - fn call(&self, name: &str, params: &[Value]) -> Result, Box>; - fn context(&self) -> Ref; - fn context_mut(&mut self) -> RefMut; - fn exports(&self) -> ExportsIterator>; -} -``` - -The `load`, `get_internal` and `set_internal` methods have been removed. - -Some `Result`'s errors have changed: The `func` and `dyn_func` methods -return a `Result<…, ExportError>` instead of `ResolveResult<…>`; The -`resolve_func` method returns a `Result` instead of -`ResolveError`; The `call` method returns a `Result<…, Box>` instead of `CallResult<…>`. - -The `context` and `context_mut` methods respectively return a -`Ref` and `RefMut` instead of `&Ctx` and `&mut Ctx`. - -The `exports` method returns an `ExportsIterator>` instead of `ExportsIter`. That's basically the same. - -### `Memory` - -Before: - -```rust -impl Memory { - fn new(desc: MemoryDescriptor) -> Result; - fn grow(&self, delta: Pages) -> Result; -} - -``` - -After: - -```rust -impl Memory { - fn new(desc: MemoryDescriptor) -> Result; - fn grow(&self, delta: Pages) -> Result; -} -``` - -Only the `Result`'s errors have changed between `new` and `grow` from -respectively `CreationError` and `GrowError` to a general -`MemoryError` type. - -### `MemoryDescriptor` - -Before - -```rust -struct MemoryDescriptor { - memory_type: MemoryType, -} -``` - -After: - -```rust -struct MemoryDescriptor {} -``` - -The `memory_type` field has been removed. - -### `MemoryType` - -Before: - -```rust -enum MemoryType { - Static, - SharedStatic, -} -``` - -After: - -```rust -enum MemoryType { - Static { bound: Pages }, -} -``` - -The `SharedStatic` variant has been removed. - -The `Static` variant is now a structure of type `Static { bound: Pages }`. - -### `Module` - -Before: - -```rust -impl Module { - fn instantiate(&self, import_object: &ImportObject) -> Result; - fn cache(&self) -> Result; - fn custom_sections(&self, key: impl AsRef) -> Option<&[Vec]> -} -``` - -After: - -```rust -impl Module { - fn instantiate(&self, import_object: &ImportObject) -> Result; - fn cache(&self) -> Result; - fn custom_sections(&self, key: impl AsRef) -> Option>>; -} -``` - -The `Result`'s errors of `instantiate` and `cache` have changed -respectively from `Error` and `CacheError` to `InstantiationError` and -`Infallible`. For `cache`, it means that it will never fail. The -`Result` is kept to avoid a change in the API. - -The `custom_sections` method returns an `Option>` instead -of `Option<&[Vec]>`. - -### `ModuleInfo` - -Before: - -```rust -struct ModuleInfo { - backend: String, - custom_sections: HashMap>>, - data_initializers: Vec, - elem_initializers: Vec, - em_symbol_map: Option>, - func_assoc: Map, - generate_debug_info: bool, - globals: Map, - imported_functions: Map, - imported_globals: Map, - imported_memories: Map, - imported_tables: Map, - memories: Map, - name_table: StringTable, - namespace_table: StringTable, - signatures: Map, - start_function: Option, - tables: Map, -} -``` - -After: - -```rust -struct ModuleInfo { - custom_sections: IndexMap, - custom_sections_data: PrimaryMap>, - function_names: HashMap, - functions: PrimaryMap, - global_initializers: PrimaryMap, - globals: PrimaryMap, - id: ModuleId, - imports: IndexMap<(String, String, u32), ImportIndex>, - memories: PrimaryMap, - name: Option, - num_imported_functions: usize, - num_imported_globals: usize, - num_imported_memories: usize, - num_imported_tables: usize, - passive_data: HashMap>, - passive_elements: HashMap>, - signatures: PrimaryMap, - start_function: Option, - table_initializers: Vec, - tables: PrimaryMap, -} -``` - -We are not going to re-phrase the differences here, but clearly a lot -has changed. - -### `Namespace` - -Before: - -```rust -impl Namespace { - fn insert(&mut self, name: S, export: E) -> Option>; -} -``` - -After: - -```rust -impl Namespace { - fn insert(&mut self, name: S, export: E); -} -``` - -The `insert` method no longer returns a value. - -### `NativeWasmType` - -Before: - -```rust -trait NativeWasmType { - const TYPE: Type; - - fn from_binary(bits: u64) -> Self; - fn to_binary(self) -> u64; -} -``` - -After: - -```rust -trait NativeWasmType { - type Abi: Copy + std::fmt::Debug; - const WASM_TYPE: Type; - - fn from_binary(binary: i128) -> Self; - fn to_binary(self) -> i128; - fn into_abi(self) -> Self::Abi; - fn from_abi(abi: Self::Abi) -> Self; - fn to_value(self) -> Value; -} -``` - -The `TYPE` constant has been renamed `WASM_TYPE`. - -The `into_abi`, `from_abi` and `to_value` methods are new, in addition -to the `Abi` type. - -The `to_binary` and `from_binary` methods now take a `i128` instead of -a `u64`. - -### `Pages` - -Before: - -```rust -impl Pages { - fn checked_add(self, rhs: Self) -> Result; -} -``` - -After: - -```rust -impl Pages { - fn checked_add(self, rhs: Self) -> Option; - const fn max_values() -> Self; -} -``` - -The `checked_add` method now returns an `Option` rather than a -`Result`. - -The constant `max_values` function has been introduced. - -### `Table` - -Before: - -```rust -impl Table { - fn new(desc: TableDescriptor) -> Result; - fn set(&self, index: u32, element: T) -> Result<(), TableAccessError>; - fn grow(&self, delta: u32) -> Result; - fn vm_local_table(&mut self) -> *mut LocalTable; -} -``` - -After: - -```rust -impl Table { - fn new(desc: TableDescriptor, initial_value: Value) -> Result; - fn set(&self, index: u32, element: Value) -> Result<(), RuntimeError>; - fn get(&self, index: u32) -> Option; - fn grow(&self, delta: u32, initial_value: Value) -> Result; -} -``` - -The `new` constructor takes an `initial_value` and returns a -`RuntimeError` in case of an error instead of a `CreationError`. - -The `set` method takes a `Value` rather a `T: StorableInTable`. It -also returns a `RuntimeError` rather than a `TableAccessError` in case -of an error. - -The `get` method is new! - -The `grow` method takes an `initial_value`, just like `new`, and also -returns a `RuntimeError` rather than a `GrowError`. - -Finally, the `vm_local_table` method has been removed. It was quite an -internal API, it's unlikely it will impact your project. - -### `TableDescriptor` - -Before: - -```rust -struct TableDescriptor { - element: ElementType, -} -``` - -After: - -```rust -struct TableDescriptor { - ty: Type, -} -``` - -The `element` field has been renamed `ty`. - -A `new` constructor has been introduced: `fn new(ty: Type, minimum: -u32, maximum: Option) -> Self`. - -### `WasmTypeList` - -Before: - -```rust -trait WasmTypeList { - type RetArray: AsMut<[u64]>; - - fn from_ret_array(array: Self::RetArray) -> Self; - fn empty_ret_array() -> Self::RetArray; - fn types() -> &'static [Type]; - fn call(self, f: NonNull, wasm: Wasm, ctx: *mut Ctx) -> Result; -} -``` - -After: - -```rust -trait WasmTypeList { - type Array: AsMut<[i128]>; - - fn from_array(array: Self::Array) -> Self; - fn empty_array(self) -> Self::Array; - fn wasm_types() -> &'static [Type]; - fn from_slice(slice: &[i128]) -> Result; - fn into_array(self) -> Self::Array; -} -``` - -The `RetArray` type has been renamed `Array`. The concrete type must -now implement the `AsMut<[i128]>` trait instead of `AsMut<[u64]>`. - -`from_ret_array` and `empty_ret_array` have been renamed -accordingly like `from_array` and `empty_array`. Note that -`empty_array` is now a method instead of an associated function. - -The `types` function has been renamed `wasm_types`. - -The `call` method has been removed. It was part of an internal API, -it's unlikely it will break your code. - -The `from_slice` constructor and the `into_array` method are new! - -### `WasmHash` - -Before: - -```rust -impl WasmHash { - fn decode(hex_str: &str) -> Result; -} -``` - -After: - -```rust -impl WasmHash { - fn decode(hex_str: &str) -> Result; -} -``` - -The `Result`'s error has changed from `Error` to `DeserializeError` -for the `decode` method. - -### imports! - -The imports macro does not support a callback as the first argument anymore. - -Before - -```rust -let import_obj = imports! { - || { setup_context::(GAS_LIMIT) }, - "env" => { - "db_read" => Func::new(|_a: u32| -> u32 { 0 }), - "db_write" => Func::new(|_a: u32, _b: u32| {}), - "db_remove" => Func::new(|_a: u32| {}), - }, -}; -``` - -After: - -```rust -let import_obj = imports! { - "env" => { - "db_read" => Func::new(|_ctx: &mut Ctx, _a: u32| -> u32 { 0 }), - "db_write" => Func::new(|_ctx: &mut Ctx, _a: u32, _b: u32| {}), - "db_remove" => Func::new(|_ctx: &mut Ctx, _a: u32| {}), - }, -}; -``` diff --git a/lib/deprecated/runtime-core/Cargo.lock b/lib/deprecated/runtime-core/Cargo.lock deleted file mode 100644 index e324cab7eb9..00000000000 --- a/lib/deprecated/runtime-core/Cargo.lock +++ /dev/null @@ -1,1453 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" -dependencies = [ - "gimli 0.22.0", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "backtrace" -version = "0.3.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" -dependencies = [ - "addr2line", - "cfg-if 0.1.10", - "libc", - "miniz_oxide", - "object 0.20.0", - "rustc-demangle", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "blake3" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f88a20f7dc23e3896bcbd85add056543c87215de721468b90e0c85d5a9f365" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac", - "digest", -] - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "cc" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - -[[package]] -name = "const_fn" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cranelift-bforest" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ca3560686e7c9c7ed7e0fe77469f2410ba5d7781b1acaa9adc8d8deea28e3e" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf9bf1ffffb6ce3d2e5ebc83549bd2436426c99b31cc550d521364cbe35d276" -dependencies = [ - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "gimli 0.24.0", - "log", - "regalloc", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc21936a5a6d07e23849ffe83e5c1f6f50305c074f4b2970ca50c13bf55b821" -dependencies = [ - "cranelift-codegen-shared", - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca5b6ffaa87560bebe69a5446449da18090b126037920b0c1c6d5945f72faf6b" - -[[package]] -name = "cranelift-entity" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6b4a8bef04f82e4296782646f733c641d09497df2fabf791323fefaa44c64c" - -[[package]] -name = "cranelift-frontend" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b783b351f966fce33e3c03498cb116d16d97a8f9978164a60920bd0d3a99c" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" -dependencies = [ - "cfg-if 1.0.0", - "const_fn", - "crossbeam-utils", - "lazy_static", - "memoffset 0.5.5", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "const_fn", - "lazy_static", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "dynasm" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a59fbab09460c1569eeea9b5e4cf62f13f5198b1c2ba0e5196dd7fdd17cd42" -dependencies = [ - "bitflags", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dynasmrt" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bec3edae2841d37b1c3dc7f3fd403c9061f26e9ffeeee97a3ea909b1bb2ef1" -dependencies = [ - "byteorder", - "dynasm", - "memmap", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" - -[[package]] -name = "enumset" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3365a51d694a57eb4ee05fb3a7f11353708b1f3f1e9a3da4d003d7fcd1dd5135" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c0ab0a4d1e54dfbfef7aca606f4501af48235308449c7d985b0bbd2f8393ff" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" - -[[package]] -name = "gimli" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - -[[package]] -name = "hermit-abi" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "inkwell" -version = "0.1.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fe0be1e47c0c0f3da4397693e08f5d78329ae095c25d529e12ade78420fb41" -dependencies = [ - "either", - "inkwell_internals", - "libc", - "llvm-sys", - "once_cell", - "parking_lot", - "regex", -] - -[[package]] -name = "inkwell_internals" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e1f71330ccec54ee62533ae88574c4169b67fb4b95cbb1196a1322582abd11" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "instant" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "itertools" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -dependencies = [ - "either", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "leb128" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" - -[[package]] -name = "libc" -version = "0.2.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" - -[[package]] -name = "libloading" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" -dependencies = [ - "cfg-if 1.0.0", - "winapi", -] - -[[package]] -name = "llvm-sys" -version = "110.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ede189444b8c78907e5d36da5dabcf153170fcff9c1dba48afc4b33c7e19f0" -dependencies = [ - "cc", - "lazy_static", - "libc", - "regex", - "semver 0.11.0", -] - -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "loupe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79b0cc3aa7552a59274f642a0a6e7419b7f5438aba06a0a82825918ba69f0e6" -dependencies = [ - "indexmap", - "loupe-derive", - "rustversion", -] - -[[package]] -name = "loupe-derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a545b22ceeec36de91c46206afd384c17946bd62b95b76e927a2adb77fbdcc0" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "memmap2" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73be3b7d04a0123e933fea1d50d126cc7196bbc0362c0ce426694f777194eee" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" -dependencies = [ - "adler", -] - -[[package]] -name = "more-asserts" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - -[[package]] -name = "object" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" -dependencies = [ - "crc32fast", - "indexmap", -] - -[[package]] -name = "once_cell" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" - -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" - -[[package]] -name = "proc-macro-error" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "syn-mid", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "ptr_meta" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6de4703776ff261fe3cbf05c8781f129b284e57ee35a785fe6c92b1dcf93a612" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53005b9863728f508d3f23ae37e03d60986a01b65f7ae8397dcebaa1d5e54e10" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rayon" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "regalloc" -version = "0.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" -dependencies = [ - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "rkyv" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c9ecd78453f7b64de7f61d168f4ade7b85433fe9102723fc1c39d5ffb305ac" -dependencies = [ - "memoffset 0.6.1", - "ptr_meta", - "rkyv_derive", - "seahash", -] - -[[package]] -name = "rkyv_derive" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3fccbf52ee0b76a29417794226e225798dd6bd32e40debd9e284cecc20dd76" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustversion" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.1", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "semver-parser" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ef146c2ad5e5f4b037cd6ce2ebb775401729b19a82040c1beac9d36c7d1428" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - -[[package]] -name = "subtle" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" - -[[package]] -name = "syn" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "syn-mid" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "target-lexicon" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834" - -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "tracing" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" -dependencies = [ - "cfg-if 0.1.10", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasmer" -version = "1.0.2" -dependencies = [ - "cfg-if 1.0.0", - "indexmap", - "loupe", - "more-asserts", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-llvm", - "wasmer-compiler-singlepass", - "wasmer-derive", - "wasmer-engine", - "wasmer-engine-dylib", - "wasmer-engine-universal", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-cache" -version = "1.0.2" -dependencies = [ - "blake3", - "hex", - "thiserror", - "wasmer", -] - -[[package]] -name = "wasmer-compiler" -version = "1.0.2" -dependencies = [ - "enumset", - "loupe", - "rkyv", - "serde", - "serde_bytes", - "smallvec", - "target-lexicon", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "1.0.2" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "gimli 0.24.0", - "loupe", - "more-asserts", - "rayon", - "smallvec", - "tracing", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-compiler-llvm" -version = "1.0.2" -dependencies = [ - "byteorder", - "cc", - "inkwell", - "itertools", - "lazy_static", - "libc", - "loupe", - "object 0.24.0", - "rayon", - "regex", - "rustc_version", - "semver 0.11.0", - "smallvec", - "target-lexicon", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-compiler-singlepass" -version = "1.0.2" -dependencies = [ - "byteorder", - "dynasm", - "dynasmrt", - "lazy_static", - "loupe", - "more-asserts", - "rayon", - "smallvec", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-derive" -version = "1.0.2" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasmer-engine" -version = "1.0.2" -dependencies = [ - "backtrace", - "lazy_static", - "loupe", - "memmap2", - "more-asserts", - "rustc-demangle", - "serde", - "serde_bytes", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-engine-dylib" -version = "1.0.2" -dependencies = [ - "cfg-if 1.0.0", - "leb128", - "libloading", - "loupe", - "rkyv", - "serde", - "tempfile", - "tracing", - "wasmer-compiler", - "wasmer-engine", - "wasmer-object", - "wasmer-types", - "wasmer-vm", - "which", -] - -[[package]] -name = "wasmer-engine-universal" -version = "1.0.2" -dependencies = [ - "cfg-if 1.0.0", - "leb128", - "loupe", - "region", - "rkyv", - "wasmer-compiler", - "wasmer-engine", - "wasmer-types", - "wasmer-vm", - "winapi", -] - -[[package]] -name = "wasmer-object" -version = "1.0.2" -dependencies = [ - "object 0.24.0", - "thiserror", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-runtime-core" -version = "0.18.0" -dependencies = [ - "blake3", - "lazy_static", - "wasmer", - "wasmer-cache", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-llvm", - "wasmer-compiler-singlepass", - "wasmer-engine", - "wasmer-engine-universal", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-types" -version = "1.0.2" -dependencies = [ - "indexmap", - "loupe", - "rkyv", - "serde", - "thiserror", -] - -[[package]] -name = "wasmer-vm" -version = "1.0.2" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "indexmap", - "libc", - "loupe", - "memoffset 0.6.1", - "more-asserts", - "region", - "rkyv", - "serde", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmparser" -version = "0.78.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c7a8b20306d43c09c2c34e0ef68bf2959a11b01a5cae35e4c5dc1e7145547b6" - -[[package]] -name = "wast" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1844f66a2bc8526d71690104c0e78a8e59ffa1597b7245769d174ebb91deb5" -dependencies = [ - "leb128", -] - -[[package]] -name = "wat" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce85d72b74242c340e9e3492cfb602652d7bb324c3172dd441b5577e39a2e18c" -dependencies = [ - "wast", -] - -[[package]] -name = "which" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" -dependencies = [ - "libc", - "thiserror", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/lib/deprecated/runtime-core/Cargo.toml b/lib/deprecated/runtime-core/Cargo.toml deleted file mode 100644 index cd44b8ac498..00000000000 --- a/lib/deprecated/runtime-core/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[package] -name = "wasmer-runtime-core" -version = "0.18.0" -description = "Wasmer runtime core library (deprecated in favor of wasmer crate)" -categories = ["wasm"] -keywords = ["wasm", "webassembly", "runtime"] -authors = ["Wasmer Engineering Team "] -repository = "https://github.com/wasmerio/wasmer" -license = "MIT" -readme = "README.md" -edition = "2018" - -[badges] -maintenance = { status = "deprecated" } - -[dependencies] -wasmer-types = { path = "../../types", version = "1.0.2" } -wasmer = { path = "../../api", version = "1.0.2", features = ["deprecated"] } -wasmer-cache = { path = "../../cache", version = "1.0.2" } -wasmer-compiler = { path = "../../compiler", version = "1.0.2", features = ["translator"] } -wasmer-compiler-llvm = { path = "../../compiler-llvm", version = "1.0.2", optional = true } -wasmer-compiler-cranelift = { path = "../../compiler-cranelift", version = "1.0.2", optional = true } -wasmer-compiler-singlepass = { path = "../../compiler-singlepass", version = "1.0.2", optional = true } -wasmer-engine = { path = "../../engine", version = "1.0.2" } -wasmer-engine-universal = { path = "../../engine-universal", version = "1.0.2" } -wasmer-vm = { path = "../../vm", version = "1.0.2" } -lazy_static = "1.4" - -[build-dependencies] -blake3 = "0.3" - -[features] -default = ["wasmer/default"] -cranelift = ["wasmer/cranelift", "wasmer-compiler-cranelift"] -llvm = ["wasmer/llvm", "wasmer-compiler-llvm"] -singlepass = ["wasmer/singlepass", "wasmer-compiler-singlepass"] -default-backend-cranelift = ["cranelift"] -default-backend-llvm = ["llvm"] -default-backend-singlepass = ["singlepass"] -dynamicfunc-fat-closures = [] diff --git a/lib/deprecated/runtime-core/README.md b/lib/deprecated/runtime-core/README.md deleted file mode 100644 index 0b5319799ec..00000000000 --- a/lib/deprecated/runtime-core/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# `wasmer-runtime-core` [DEPRECATED] [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/master/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-runtime-core.svg)](https://crates.io/crates/wasmer-runtime-core) - -## Deprecation notice: please read - -Thanks to users feedback, collected experience and various use cases, -Wasmer has decided to entirely improve its API to offer the best user -experience and the best features to as many users as possible. - -The new version of Wasmer (`1.0.0`) includes many improvements -in terms of performance or the memory consumption, in addition to a ton -of new features and much better flexibility! -You can check revamped new API in the [`wasmer`] crate. - -In order to help our existing users to enjoy the performance boost and -memory improvements without updating their program that much, we have -created a new version of the `wasmer-runtime-core` crate, which is now -*an adaptation* of the new API but with the old API syntax, as much as -possible. Indeed, it was not always possible to provide the exact same -API, but changes are subtle. - -We have carefully documented most of the differences in [the -`runtime-core/CHANGES.md` document][changes]. - -It is important to understand the public of this port. We do not -recommend to advanced users of Wasmer to use this port. Advanced API, -like `ModuleInfo` or the `vm` module (incl. `vm::Ctx`) have not been -fully ported because it was very internals to Wasmer. For advanced -users, we highly recommend to migrate to the new version of Wasmer, -which is awesome by the way (completely neutral opinion). The public -for this port is beginners or regular users that do not necesarily -have time to update their code immediately but that want to enjoy a -performance boost and memory improvements. - -[`wasmer`]: https://crates.io/crates/wasmer/ -[changes]: ./CHANGES.md - -## Introduction - -The `wasmer-runtime-core` was the entry point to the Wasmer Runtime, -by providing common types to compile and to instantiate a WebAssembly -module. - -Most Wasmer users should prefer the API which is re-exported by the -[`wasmer-runtime`] library by default. This crate provides additional -APIs which may be useful to users that wish to customize the Wasmer -runtime. - -[`wasmer-runtime`]: https://github.com/wasmerio/wasmer/tree/master/lib/deprecated/runtime diff --git a/lib/deprecated/runtime-core/build.rs b/lib/deprecated/runtime-core/build.rs deleted file mode 100644 index 38c38661f4a..00000000000 --- a/lib/deprecated/runtime-core/build.rs +++ /dev/null @@ -1,29 +0,0 @@ -use blake3::Hasher; -use std::{env, fs, io::Write, path::PathBuf}; - -const WASMER_VERSION: &'static str = env!("CARGO_PKG_VERSION"); - -fn main() { - // `wasmer_version_hash.txt` - { - let mut hasher = Hasher::new(); - hasher.update(WASMER_VERSION.as_bytes()); - - let hasher = hasher.finalize(); - let hash_string = hasher.to_hex().as_str().to_owned(); - - let crate_dir = env::var("OUT_DIR").unwrap(); - let wasmer_version_hash_file = { - let mut path = PathBuf::from(&crate_dir); - path.push("wasmer_version_hash.txt"); - path - }; - - let mut f_out = fs::File::create(wasmer_version_hash_file) - .expect("Could not create file for wasmer hash value"); - - f_out - .write_all(hash_string.as_bytes()) - .expect("Could not write to file for wasmer hash value"); - } -} diff --git a/lib/deprecated/runtime-core/doc/new-api/artifact.rs b/lib/deprecated/runtime-core/doc/new-api/artifact.rs deleted file mode 100644 index 9ab8dc36446..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/artifact.rs +++ /dev/null @@ -1,8 +0,0 @@ -struct Artifact {} - -impl Artifact { - unsafe fn deserialize(bytes: &[u8]) -> Result; - fn info(&self) -> &ModuleInfo; - fn serialize(&self) -> Result, Error>; - fn module(self) -> Module; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/bytes.rs b/lib/deprecated/runtime-core/doc/new-api/bytes.rs deleted file mode 100644 index 0ba4d85df9e..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/bytes.rs +++ /dev/null @@ -1 +0,0 @@ -struct Bytes(pub usize); diff --git a/lib/deprecated/runtime-core/doc/new-api/dynamicfunc.rs b/lib/deprecated/runtime-core/doc/new-api/dynamicfunc.rs deleted file mode 100644 index 427e2a0b647..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/dynamicfunc.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct DynamicFunc {} - -impl DynamicFunc { - fn new(signature: &FuncSig, func: F) -> Self; - fn signature(&self) -> &FuncSig; - fn params(&self) -> &[Type]; - fn returns(&self) -> &[Type]; - fn call(&self, params: &[Value]) -> Result, RuntimeError>; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/dynfunc.rs b/lib/deprecated/runtime-core/doc/new-api/dynfunc.rs deleted file mode 100644 index 3c7a319304c..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/dynfunc.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct DynFunc {} - -impl DynFunc { - fn call(&self, params: &[Value]) -> Result, CallError>; - fn signature(&self) -> &FuncSig; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/export_descriptor.rs b/lib/deprecated/runtime-core/doc/new-api/export_descriptor.rs deleted file mode 100644 index 7f45d5630db..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/export_descriptor.rs +++ /dev/null @@ -1,4 +0,0 @@ -struct ExportDescriptor { - name: String, - ty: ExternDescriptor, -} diff --git a/lib/deprecated/runtime-core/doc/new-api/exports.rs b/lib/deprecated/runtime-core/doc/new-api/exports.rs deleted file mode 100644 index aab0311addc..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/exports.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct Exports {} - -impl Exports { - fn get<'a, T: Exportable<'a> + Clone + 'a>(&'a self, name: &str) -> Result; - fn iter(&self) -> ExportsIterator>; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/func.rs b/lib/deprecated/runtime-core/doc/new-api/func.rs deleted file mode 100644 index bab0f7e6e9e..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/func.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct Func {} - -impl Func { - fn new(func: F) -> Self; - fn params(&self) -> &[Type]; - fn returns(&self) -> &[Type]; - fn call(...) -> Result; - fn dyn_call(&self, params: &[Value]) -> Result, RuntimeError>; - fn signature(&self) -> &FuncSig; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/func_sig.rs b/lib/deprecated/runtime-core/doc/new-api/func_sig.rs deleted file mode 100644 index 740bb0aa373..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/func_sig.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct FuncSig {} - -impl FuncSig { - fn new(params: Params, returns: Returns) -> Self; - fn params(&self) -> &[Type]; - fn results(&self) -> &[Type]; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/global.rs b/lib/deprecated/runtime-core/doc/new-api/global.rs deleted file mode 100644 index 9311cd8bca1..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/global.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct Global {} - -impl Global { - fn new(value: Value) -> Self; - fn new_mutable(value: Value) -> Self; - fn descriptor(&self) -> GlobalDescriptor; - fn set(&self, value: Value); - fn get(&self) -> Value; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/global_descriptor.rs b/lib/deprecated/runtime-core/doc/new-api/global_descriptor.rs deleted file mode 100644 index 05dd8489803..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/global_descriptor.rs +++ /dev/null @@ -1,4 +0,0 @@ -struct GlobalDescriptor { - mutable: bool, - ty: Type, -} diff --git a/lib/deprecated/runtime-core/doc/new-api/global_init.rs b/lib/deprecated/runtime-core/doc/new-api/global_init.rs deleted file mode 100644 index 1a6a857aacb..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/global_init.rs +++ /dev/null @@ -1,15 +0,0 @@ -enum GlobalInit { - I32Const(i32), - I64Const(i64), - F32Const(f32), - F64Const(f64), - V128Const(V128), - GetGlobal(GlobalIndex), - RefNullConst, - RefFunc(FunctionIndex), -} - -impl GlobalInit { - fn from_value(value: Value) -> Self; - fn to_value(&self) -> Value; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/host_function.rs b/lib/deprecated/runtime-core/doc/new-api/host_function.rs deleted file mode 100644 index 6eb82dfa89d..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/host_function.rs +++ /dev/null @@ -1,3 +0,0 @@ -trait HostFunction { - fn function_body_ptr(self) -> *const VMFunctionBody; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/import_descriptor.rs b/lib/deprecated/runtime-core/doc/new-api/import_descriptor.rs deleted file mode 100644 index 59b9f91d61b..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/import_descriptor.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct ImportDescriptor { - module: String, - name: String, - ty: ExternDescriptor, -} diff --git a/lib/deprecated/runtime-core/doc/new-api/import_object.rs b/lib/deprecated/runtime-core/doc/new-api/import_object.rs deleted file mode 100644 index a6e499667d2..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/import_object.rs +++ /dev/null @@ -1,11 +0,0 @@ -struct ImportObject {} - -impl ImportObject { - fn new() -> Self; - fn new_with_data(state_creator: F) -> Self; - fn register(&mut self, name: S, namespace: N) -> Option>; - fn contains_namespace(&self, name: &str) -> bool; - fn call_state_creator(&self) -> Option<(*mut c_void, fn(*mut c_void))>; - fn get_export(&self, module: &str, name: &str) -> Option; - fn clone_ref(&self) -> Self; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/instance.rs b/lib/deprecated/runtime-core/doc/new-api/instance.rs deleted file mode 100644 index 6243f25ff33..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/instance.rs +++ /dev/null @@ -1,14 +0,0 @@ -struct Instance { - exports: Exports, -} - -impl Instance { - fn func(&self, name: &str) -> Result, ExportError>; - fn resolve_func(&self, name: &str) -> Result; - fn dyn_func(&self, name: &str) -> Result; - fn call(&self, name: &str, params: &[Value]) -> Result, Box>; - fn context(&self) -> Ref; - fn context_mut(&mut self) -> RefMut; - fn exports(&self) -> ExportsIterator>; - fn module(&self) -> Module; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/memory.rs b/lib/deprecated/runtime-core/doc/new-api/memory.rs deleted file mode 100644 index c6dcee83108..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/memory.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct Memory {} - -impl Memory { - fn new(desc: MemoryDescriptor) -> Result; - fn descriptor(&self) -> MemoryDescriptor; - fn grow(&self, delta: Pages) -> Result; - fn size(&self) -> Pages; - fn view(&self) -> MemoryView; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/memory_descriptor.rs b/lib/deprecated/runtime-core/doc/new-api/memory_descriptor.rs deleted file mode 100644 index 88cee38a0ab..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/memory_descriptor.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct MemoryDescriptor { - minimum: Pages, - maximum: Option, - shared: bool, -} diff --git a/lib/deprecated/runtime-core/doc/new-api/memory_type.rs b/lib/deprecated/runtime-core/doc/new-api/memory_type.rs deleted file mode 100644 index 4a8d9b9e68a..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/memory_type.rs +++ /dev/null @@ -1,4 +0,0 @@ -enum MemoryType { - Dynamic, - Static { bound: Pages }, -} diff --git a/lib/deprecated/runtime-core/doc/new-api/memory_view.rs b/lib/deprecated/runtime-core/doc/new-api/memory_view.rs deleted file mode 100644 index e58fec52c82..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/memory_view.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct MemoryView {} - -impl MemoryView { - fn atomically(&self) -> MemoryView<'a, T::Output, Atomically>; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/module.rs b/lib/deprecated/runtime-core/doc/new-api/module.rs deleted file mode 100644 index 87af11fbdd7..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/module.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct Module {} - -impl Module { - fn instantiate(&self, import_object: &ImportObject) -> Result; - fn cache(&self) -> Result; - fn info(&self) -> &ModuleInfo; - fn imports(&self) -> Vec; - fn exports(&self) -> Vec; - fn custom_sections(&self, key: impl AsRef) -> Option>>; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/module_info.rs b/lib/deprecated/runtime-core/doc/new-api/module_info.rs deleted file mode 100644 index 020f3f376a7..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/module_info.rs +++ /dev/null @@ -1,23 +0,0 @@ -struct ModuleInfo { - custom_sections: IndexMap, - custom_sections_data: PrimaryMap>, - exports: IndexMap, - function_names: HashMap, - functions: PrimaryMap, - global_initializers: PrimaryMap, - globals: PrimaryMap, - id: ModuleId, - imports: IndexMap<(String, String, u32), ImportIndex>, - memories: PrimaryMap, - name: Option, - num_imported_functions: usize, - num_imported_globals: usize, - num_imported_memories: usize, - num_imported_tables: usize, - passive_data: HashMap>, - passive_elements: HashMap>, - signatures: PrimaryMap, - start_function: Option, - table_initializers: Vec, - tables: PrimaryMap, -} diff --git a/lib/deprecated/runtime-core/doc/new-api/namespace.rs b/lib/deprecated/runtime-core/doc/new-api/namespace.rs deleted file mode 100644 index 44381395913..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/namespace.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct Namespace {} - -impl Namespace { - fn new() -> Self; - fn insert(&mut self, name: S, export: E); - fn contains_key(&mut self, key: S) -> bool; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/native_wasm_type.rs b/lib/deprecated/runtime-core/doc/new-api/native_wasm_type.rs deleted file mode 100644 index 665f35897e5..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/native_wasm_type.rs +++ /dev/null @@ -1,10 +0,0 @@ -trait NativeWasmType { - type Abi: Copy + std::fmt::Debug; - const WASM_TYPE: Type; - - fn from_binary(binary: i128) -> Self; - fn to_binary(self) -> i128; - fn into_abi(self) -> Self::Abi; - fn from_abi(abi: Self::Abi) -> Self; - fn to_value(self) -> Value; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/pages.rs b/lib/deprecated/runtime-core/doc/new-api/pages.rs deleted file mode 100644 index 11e28c33079..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/pages.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct Pages(pub u32); - -impl Pages { - fn checked_add(self, rhs: Self) -> Option; - fn bytes(self) -> Bytes; - const fn max_values() -> Self; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/table.rs b/lib/deprecated/runtime-core/doc/new-api/table.rs deleted file mode 100644 index ed24ac60b25..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/table.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct Table {} - -impl Table { - fn new(desc: TableDescriptor, initial_value: Value) -> Result; - fn descriptor(&self) -> TableDescriptor; - fn set(&self, index: u32, element: Value) -> Result<(), RuntimeError>; - fn get(&self, index: u32) -> Option; - fn size(&self) -> u32; - fn grow(&self, delta: u32, initial_value: Value) -> Result; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/table_descriptor.rs b/lib/deprecated/runtime-core/doc/new-api/table_descriptor.rs deleted file mode 100644 index dede0a88499..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/table_descriptor.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct TableDescriptor { - ty: Type, - minimum: u32, - maximum: Option, -} - -impl TableDescriptor { - fn new(ty: Type, minimum: u32, maximum: Option) -> Self; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/wasm_extern_type.rs b/lib/deprecated/runtime-core/doc/new-api/wasm_extern_type.rs deleted file mode 100644 index e3aa4572a05..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/wasm_extern_type.rs +++ /dev/null @@ -1,6 +0,0 @@ -trait WasmExternType { - type Native: NativeWasmType; - - fn from_native(native: Self::Native) -> Self; - fn to_native(self) -> Self::Native; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/wasm_type_list.rs b/lib/deprecated/runtime-core/doc/new-api/wasm_type_list.rs deleted file mode 100644 index 33c1966f3cc..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/wasm_type_list.rs +++ /dev/null @@ -1,12 +0,0 @@ -trait WasmTypeList { - type CStruct; - type Array: AsMut<[i128]>; - - fn from_array(array: Self::Array) -> Self; - fn empty_array(self) -> Self::Array; - fn from_c_struct(c_struct: Self::CStruct) -> Self; - fn into_c_struct(self) -> Self::CStruct; - fn wasm_types() -> &'static [Type]; - fn from_slice(slice: &[i128]) -> Result; - fn into_array(self) -> Self::Array; -} diff --git a/lib/deprecated/runtime-core/doc/new-api/wasmhash.rs b/lib/deprecated/runtime-core/doc/new-api/wasmhash.rs deleted file mode 100644 index 7215bbd850c..00000000000 --- a/lib/deprecated/runtime-core/doc/new-api/wasmhash.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct WasmHash {} - -impl WasmHash { - fn generate(wasm: &[u8]) -> Self; - fn encode(self) -> String; - fn decode(hex_str: &str) -> Result; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/artifact.rs b/lib/deprecated/runtime-core/doc/old-api/artifact.rs deleted file mode 100644 index 75184b8fd27..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/artifact.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct Artifact {} - -impl Artifact { - fn deserialize(bytes: &[u8]) -> Result; - fn info(&self) -> &ModuleInfo; - fn serialize(&self) -> Result, Error>; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/bytes.rs b/lib/deprecated/runtime-core/doc/old-api/bytes.rs deleted file mode 100644 index 0ba4d85df9e..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/bytes.rs +++ /dev/null @@ -1 +0,0 @@ -struct Bytes(pub usize); diff --git a/lib/deprecated/runtime-core/doc/old-api/dynamicfunc.rs b/lib/deprecated/runtime-core/doc/old-api/dynamicfunc.rs deleted file mode 100644 index 423eb7d97e4..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/dynamicfunc.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct DynamicFunc {} - -impl DynamicFunc { - fn new(signature: Arc, func: F) -> Self; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/dynfunc.rs b/lib/deprecated/runtime-core/doc/old-api/dynfunc.rs deleted file mode 100644 index c82a25102ae..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/dynfunc.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct DynFunc {} - -impl DynFunc { - fn call(&self, params: &[Value]) -> Result, CallError>; - fn signature(&self) -> &FuncSig; - fn raw(&self) -> *const Func; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/export_descriptor.rs b/lib/deprecated/runtime-core/doc/old-api/export_descriptor.rs deleted file mode 100644 index 4fc6a0c25c9..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/export_descriptor.rs +++ /dev/null @@ -1,4 +0,0 @@ -struct ExportDescriptor<'a> { - name: &'a str, - ty: ExternDescriptor, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/exports.rs b/lib/deprecated/runtime-core/doc/old-api/exports.rs deleted file mode 100644 index 25a8c868b88..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/exports.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct Exports {} - -impl Exports { - fn get<'a, T: Exportable<'a>>(&'a self, name: &str) -> Result; - fn into_iter(&self) -> ExportIter; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/func.rs b/lib/deprecated/runtime-core/doc/old-api/func.rs deleted file mode 100644 index 5643fec04e7..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/func.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct Func {} - -impl Func { - fn new(func: F) -> Self; - fn params(&self) -> &'static [Type]; - fn returns(&self) -> &'static [Type]; - fn call(...) -> Result; - fn get_vm_func(&self) -> NonNull; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/func_sig.rs b/lib/deprecated/runtime-core/doc/old-api/func_sig.rs deleted file mode 100644 index f8521a187b5..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/func_sig.rs +++ /dev/null @@ -1,8 +0,0 @@ -struct FuncSig {} - -impl FuncSig { - fn new(params: Params, returns: Returns) -> Self; - fn params(&self) -> &[Type]; - fn returns(&self) -> &[Type]; - fn check_param_value_types(&self, params: &[Value]) -> bool; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/global.rs b/lib/deprecated/runtime-core/doc/old-api/global.rs deleted file mode 100644 index 9311cd8bca1..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/global.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct Global {} - -impl Global { - fn new(value: Value) -> Self; - fn new_mutable(value: Value) -> Self; - fn descriptor(&self) -> GlobalDescriptor; - fn set(&self, value: Value); - fn get(&self) -> Value; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/global_descriptor.rs b/lib/deprecated/runtime-core/doc/old-api/global_descriptor.rs deleted file mode 100644 index 05dd8489803..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/global_descriptor.rs +++ /dev/null @@ -1,4 +0,0 @@ -struct GlobalDescriptor { - mutable: bool, - ty: Type, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/global_init.rs b/lib/deprecated/runtime-core/doc/old-api/global_init.rs deleted file mode 100644 index a2c46342c5a..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/global_init.rs +++ /dev/null @@ -1,4 +0,0 @@ -struct GlobalInit { - desc: GlobalDescriptor, - init: Initializer, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/host_function.rs b/lib/deprecated/runtime-core/doc/old-api/host_function.rs deleted file mode 100644 index 431ca38c342..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/host_function.rs +++ /dev/null @@ -1,3 +0,0 @@ -trait HostFunction { - fn to_raw(self) -> (NonNull, Option>); -} diff --git a/lib/deprecated/runtime-core/doc/old-api/import_descriptor.rs b/lib/deprecated/runtime-core/doc/old-api/import_descriptor.rs deleted file mode 100644 index af9557aec58..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/import_descriptor.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct ImportDescriptor { - namespace: String, - name: String, - ty: ExternDescriptor, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/import_object.rs b/lib/deprecated/runtime-core/doc/old-api/import_object.rs deleted file mode 100644 index b6ab7696ade..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/import_object.rs +++ /dev/null @@ -1,12 +0,0 @@ -struct ImportObject { - allow_missing_functions: bool, -} - -impl ImportObject { - fn new() -> Self; - fn new_with_data(state_creator: F) -> Self; - fn register(&mut self, name: S, namespace: N) -> Option>; - fn with_namespace(&self, namespace: &str, f: Func) -> Option; - fn maybe_with_namespace(&self, namespace: &str, f: Func) -> Option; - fn contains_namespace(&self, name: &str) -> bool; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/instance.rs b/lib/deprecated/runtime-core/doc/old-api/instance.rs deleted file mode 100644 index 07619cd74af..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/instance.rs +++ /dev/null @@ -1,18 +0,0 @@ -struct Instance { - module: Arc, - exports: Exports, -} - -impl Instance { - fn load(&self, loader: T) -> Result; - fn func(&self, name: &str) -> ResolveResult>; - fn resolve_func(&self, name: &str) -> ResolveResult; - fn dyn_func(&self, name: &str) -> ResolveResult; - fn call(&self, name: &str, params: &[Value]) -> CallResult>; - fn context(&self) -> &Ctx; - fn context_mut(&mut self) -> &mut Ctx; - fn exports(&self) -> ExportsIter; - fn module(&self) -> Module; - fn get_internal(&self, fields: &InternalField) -> u64; - fn set_internal(&self, fields: &InternalField, value: u64); -} diff --git a/lib/deprecated/runtime-core/doc/old-api/memory.rs b/lib/deprecated/runtime-core/doc/old-api/memory.rs deleted file mode 100644 index 9d453038c89..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/memory.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct Memory {} - -impl Memory { - fn new(desc: MemoryDescriptor) -> Result; - fn descriptor(&self) -> MemoryDescriptor; - fn grow(&self, delta: Pages) -> Result; - fn size(&self) -> Pages; - fn view(&self) -> MemoryView; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/memory_descriptor.rs b/lib/deprecated/runtime-core/doc/old-api/memory_descriptor.rs deleted file mode 100644 index 42e6c8fa7c1..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/memory_descriptor.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct MemoryDescriptor { - minimum: Pages, - maximum: Option, - shared: bool, - memory_type: MemoryType, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/memory_type.rs b/lib/deprecated/runtime-core/doc/old-api/memory_type.rs deleted file mode 100644 index 1b5d509c660..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/memory_type.rs +++ /dev/null @@ -1,5 +0,0 @@ -enum MemoryType { - Dynamic, - Static, - SharedStatic, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/memory_view.rs b/lib/deprecated/runtime-core/doc/old-api/memory_view.rs deleted file mode 100644 index e58fec52c82..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/memory_view.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct MemoryView {} - -impl MemoryView { - fn atomically(&self) -> MemoryView<'a, T::Output, Atomically>; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/module.rs b/lib/deprecated/runtime-core/doc/old-api/module.rs deleted file mode 100644 index 2963786ec1a..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/module.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct Module {} - -impl Module { - fn instantiate(&self, import_object: &ImportObject) -> Result; - fn cache(&self) -> Result; - fn info(&self) -> &ModuleInfo; - fn imports(&self) -> Vec; - fn exports(&self) -> Vec; - fn custom_sections(&self, key: impl AsRef) -> Option<&[Vec]> -} diff --git a/lib/deprecated/runtime-core/doc/old-api/module_info.rs b/lib/deprecated/runtime-core/doc/old-api/module_info.rs deleted file mode 100644 index 7dc79b4f7ff..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/module_info.rs +++ /dev/null @@ -1,21 +0,0 @@ -struct ModuleInfo { - backend: String, - custom_sections: HashMap>>, - data_initializers: Vec, - elem_initializers: Vec, - em_symbol_map: Option>, - exports: IndexMap, - func_assoc: Map, - generate_debug_info: bool, - globals: Map, - imported_functions: Map, - imported_globals: Map, - imported_memories: Map, - imported_tables: Map, - memories: Map, - name_table: StringTable, - namespace_table: StringTable, - signatures: Map, - start_func: Option, - tables: Map, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/namespace.rs b/lib/deprecated/runtime-core/doc/old-api/namespace.rs deleted file mode 100644 index 75a5defaadf..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/namespace.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct Namespace {} - -impl Namespace { - fn new() -> Self; - fn insert(&mut self, name: S, export: E) -> Option>; - fn contains_key(&mut self, key: S) -> bool; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/native_wasm_type.rs b/lib/deprecated/runtime-core/doc/old-api/native_wasm_type.rs deleted file mode 100644 index a6ef9d5786b..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/native_wasm_type.rs +++ /dev/null @@ -1,6 +0,0 @@ -trait NativeWasmType { - const TYPE: Type; - - fn from_binary(bits: u64) -> Self; - fn to_binary(self) -> u64; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/pages.rs b/lib/deprecated/runtime-core/doc/old-api/pages.rs deleted file mode 100644 index f82bf58c6bf..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/pages.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct Pages(pub u32); - -impl Pages { - fn checked_add(self, rhs: Self) -> Result; - fn bytes(self) -> Bytes; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/table.rs b/lib/deprecated/runtime-core/doc/old-api/table.rs deleted file mode 100644 index d7ef46babef..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/table.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct Table {} - -impl Table { - fn new(desc: TableDescriptor) -> Result; - fn descriptor(&self) -> TableDescriptor; - fn set(&self, index: u32, element: T) -> Result<(), TableAccessError>; - fn size(&self) -> u32; - fn grow(&self, delta: u32) -> Result; - fn vm_local_table(&mut self) -> *mut LocalTable; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/table_descriptor.rs b/lib/deprecated/runtime-core/doc/old-api/table_descriptor.rs deleted file mode 100644 index 59d719f3dc9..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/table_descriptor.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct TableDescriptor { - element: ElementType, - minimum: u32, - maximum: Option, -} diff --git a/lib/deprecated/runtime-core/doc/old-api/wasm_extern_type.rs b/lib/deprecated/runtime-core/doc/old-api/wasm_extern_type.rs deleted file mode 100644 index e3aa4572a05..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/wasm_extern_type.rs +++ /dev/null @@ -1,6 +0,0 @@ -trait WasmExternType { - type Native: NativeWasmType; - - fn from_native(native: Self::Native) -> Self; - fn to_native(self) -> Self::Native; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/wasm_type_list.rs b/lib/deprecated/runtime-core/doc/old-api/wasm_type_list.rs deleted file mode 100644 index f2dd7c36ac3..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/wasm_type_list.rs +++ /dev/null @@ -1,11 +0,0 @@ -trait WasmTypeList { - type CStruct; - type RetArray: AsMut<[u64]>; - - fn from_ret_array(array: Self::RetArray) -> Self; - fn empty_ret_array() -> Self::RetArray; - fn from_c_struct(c_struct: Self::CStruct) -> Self; - fn into_c_struct(self) -> Self::CStruct; - fn types() -> &'static [Type]; - fn call(self, f: NonNull, wasm: Wasm, ctx: *mut Ctx) -> Result; -} diff --git a/lib/deprecated/runtime-core/doc/old-api/wasmhash.rs b/lib/deprecated/runtime-core/doc/old-api/wasmhash.rs deleted file mode 100644 index 3e8942ad78a..00000000000 --- a/lib/deprecated/runtime-core/doc/old-api/wasmhash.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct WasmHash {} - -impl WasmHash { - fn generate(wasm: &[u8]) -> Self; - fn encode(self) -> String; - fn decode(hex_str: &str) -> Result; -} diff --git a/lib/deprecated/runtime-core/doc/review.sh b/lib/deprecated/runtime-core/doc/review.sh deleted file mode 100755 index e5afd456c2f..00000000000 --- a/lib/deprecated/runtime-core/doc/review.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -for i in `\ls new-api | grep "${1-.}"`; do - clear - echo -e "#######\n### ${i}\n#######\n\n\n\n" - diff --report-identical-files --unified=10 old-api/${i} new-api/${i} | diffr - - echo -e "\n\n\n\nPress any key to diff the next file…" - read -done diff --git a/lib/deprecated/runtime-core/src/backend.rs b/lib/deprecated/runtime-core/src/backend.rs deleted file mode 100644 index c964cfcf748..00000000000 --- a/lib/deprecated/runtime-core/src/backend.rs +++ /dev/null @@ -1,84 +0,0 @@ -use crate::new; - -pub use new::wasmer_compiler::{Architecture, Compiler, CpuFeature as Features}; - -/// Enum used to select which compiler should be used to generate code. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum Backend { - #[cfg(feature = "singlepass")] - /// Singlepass backend - Singlepass, - #[cfg(feature = "cranelift")] - /// Cranelift backend - Cranelift, - #[cfg(feature = "llvm")] - /// LLVM backend - LLVM, - /// Auto backend - Auto, -} - -impl Backend { - /// Get a list of the currently enabled (via feature flag) backends. - pub fn variants() -> &'static [&'static str] { - &[ - #[cfg(feature = "singlepass")] - "singlepass", - #[cfg(feature = "cranelift")] - "cranelift", - #[cfg(feature = "llvm")] - "llvm", - "auto", - ] - } - - /// Stable string representation of the backend. - /// It can be used as part of a cache key, for example. - pub fn to_string(&self) -> &'static str { - match self { - #[cfg(feature = "singlepass")] - Backend::Singlepass => "singlepass", - #[cfg(feature = "cranelift")] - Backend::Cranelift => "cranelift", - #[cfg(feature = "llvm")] - Backend::LLVM => "llvm", - Backend::Auto => "auto", - } - } -} - -impl Default for Backend { - fn default() -> Self { - #[cfg(feature = "default-backend-singlepass")] - return Backend::Singlepass; - - #[cfg(feature = "default-backend-cranelift")] - return Backend::Cranelift; - - #[cfg(feature = "default-backend-llvm")] - return Backend::LLVM; - - #[cfg(not(any( - feature = "default-backend-singlepass", - feature = "default-backend-cranelift", - feature = "default-backend-llvm", - )))] - panic!("There is no default-backend set."); - } -} - -impl std::str::FromStr for Backend { - type Err = String; - fn from_str(s: &str) -> Result { - match s.to_lowercase().as_str() { - #[cfg(feature = "singlepass")] - "singlepass" => Ok(Backend::Singlepass), - #[cfg(feature = "cranelift")] - "cranelift" => Ok(Backend::Cranelift), - #[cfg(feature = "llvm")] - "llvm" => Ok(Backend::LLVM), - "auto" => Ok(Backend::Auto), - _ => Err(format!("The backend {} doesn't exist", s)), - } - } -} diff --git a/lib/deprecated/runtime-core/src/cache.rs b/lib/deprecated/runtime-core/src/cache.rs deleted file mode 100644 index 806ebb91812..00000000000 --- a/lib/deprecated/runtime-core/src/cache.rs +++ /dev/null @@ -1,94 +0,0 @@ -//! The cache module provides the common data structures used by compiler backends to allow -//! serializing compiled wasm code to a binary format. The binary format can be persisted, -//! and loaded to allow skipping compilation and fast startup. - -use crate::{ - get_global_store, - module::{Module, ModuleInfo}, - new, -}; -use std::str::FromStr; - -pub use new::wasmer_cache::FileSystemCache; - -/// Kinds of caching errors -#[derive(Debug)] -pub enum Error { - /// An error deserializing bytes into a cache data structure. - DeserializeError(new::wasmer_engine::DeserializeError), - - /// An error serializing bytes from a cache data structure. - SerializeError(new::wasmer_engine::SerializeError), -} - -/// Artifact are produced by caching, are serialized/deserialized to binaries, and contain -/// module info, backend metadata, and compiled code. -pub struct Artifact { - new_module: new::wasmer::Module, -} - -impl Artifact { - pub(crate) fn new(new_module: new::wasmer::Module) -> Self { - Self { new_module } - } - - /// Serializes the `Artifact` into a vector of bytes - pub fn serialize(&self) -> Result, Error> { - self.new_module.serialize().map_err(Error::SerializeError) - } - - /// Deserializes an `Artifact` from the given byte slice. - pub unsafe fn deserialize(bytes: &[u8]) -> Result { - Ok(Self::new( - new::wasmer::Module::deserialize(&get_global_store(), bytes) - .map_err(Error::DeserializeError)?, - )) - } - - /// Get the associated module to this artifact. - pub fn module(self) -> Module { - Module::new(self.new_module) - } - - /// A reference to the `Artifact`'s stored `ModuleInfo` - pub fn info(&self) -> &ModuleInfo { - self.new_module.info() - } -} - -/// The hash of a wasm module. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct WasmHash { - new_hash: new::wasmer_cache::Hash, -} - -impl WasmHash { - /// Hash a wasm module. - /// - /// # Note - /// - /// This does no verification that the supplied data - /// is, in fact, a wasm module. - pub fn generate(wasm_bytes: &[u8]) -> Self { - Self { - new_hash: new::wasmer_cache::Hash::generate(wasm_bytes), - } - } - - /// Create the hexadecimal representation of the - /// stored hash. - pub fn encode(self) -> String { - self.new_hash.to_string() - } - - /// Create hash from hexadecimal representation - pub fn decode(hex_str: &str) -> Result { - Ok(Self { - new_hash: new::wasmer_cache::Hash::from_str(hex_str)?, - }) - } -} - -/// A unique ID generated from the version of Wasmer for use with cache versioning -pub const WASMER_VERSION_HASH: &'static str = - include_str!(concat!(env!("OUT_DIR"), "/wasmer_version_hash.txt")); diff --git a/lib/deprecated/runtime-core/src/error.rs b/lib/deprecated/runtime-core/src/error.rs deleted file mode 100644 index b90f65b946a..00000000000 --- a/lib/deprecated/runtime-core/src/error.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub use crate::new::wasmer::{ExportError, InstantiationError, MemoryError}; -pub use crate::new::wasmer_compiler::CompileError; -pub use crate::new::wasmer_engine::{LinkError, RuntimeError}; diff --git a/lib/deprecated/runtime-core/src/export.rs b/lib/deprecated/runtime-core/src/export.rs deleted file mode 100644 index ddf6d8da6d1..00000000000 --- a/lib/deprecated/runtime-core/src/export.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub use crate::new::{ - wasmer::Export as RuntimeExport, - wasmer::{Exportable, Extern as Export}, -}; diff --git a/lib/deprecated/runtime-core/src/functional_api.rs b/lib/deprecated/runtime-core/src/functional_api.rs deleted file mode 100644 index 0b47e023a16..00000000000 --- a/lib/deprecated/runtime-core/src/functional_api.rs +++ /dev/null @@ -1,105 +0,0 @@ -use crate::{ - backend::Backend, cache::Artifact, get_global_store, module::Module, new, - renew_global_store_with, -}; -use std::{convert::Infallible, error::Error}; - -pub use new::wasmer::wat2wasm; - -/// Compile WebAssembly binary code into a [`Module`]. -/// This function is useful if it is necessary to -/// compile a module before it can be instantiated -/// (otherwise, the [`instantiate`] function should be used). -/// -/// [`Module`]: struct.Module.html -/// [`instantiate`]: fn.instantiate.html -/// -/// # Params -/// -/// * `wasm`: A `&[u8]` containing the -/// binary code of the wasm module you want to compile. -/// -/// # Errors -/// -/// If the operation fails, the function returns `Err(error::CompileError::...)`. -/// -/// This function only exists if one of `default-backend-llvm`, `default-backend-cranelift`, -/// or `default-backend-singlepass` is set. -pub fn compile(bytes: &[u8]) -> Result> { - compile_with(bytes, Backend::Auto) -} - -/// Creates a new module from the given cache [`Artifact`] -pub fn load_cache_with(cache: Artifact) -> Result { - Ok(cache.module()) -} - -/// Compile a [`Module`] using the provided compiler from -/// WebAssembly binary code. This function is useful if it -/// is necessary to a compile a module before it can be instantiated -/// and must be used if you wish to use a different backend from the default. -pub fn compile_with(bytes: &[u8], compiler: Backend) -> Result> { - renew_global_store_with(compiler); - - Ok(Module::new(new::wasmer::Module::new( - &get_global_store(), - bytes, - )?)) -} - -/// The same as `compile_with` but changes the compiler behavior -/// with the values in the `CompilerConfig` -/// -/// # Note -/// -/// The third parameter isn't used any more in the deprecated version -/// of `wasmer-runtime-core`. -pub fn compile_with_config( - bytes: &[u8], - compiler: Backend, - _compiler_config: (), -) -> Result> { - renew_global_store_with(compiler); - - Ok(Module::new(new::wasmer::Module::new( - &get_global_store(), - bytes, - )?)) -} - -/// Perform validation as defined by the -/// WebAssembly specification. Returns `true` if validation -/// succeeded, `false` if validation failed. -pub fn validate(bytes: &[u8]) -> bool { - new::wasmer::Module::validate(&get_global_store(), bytes).is_ok() -} - -/// Helper macro to create a new `Func` object using the provided function pointer. -/// -/// # Usage -/// -/// Function pointers are supported. The first parameter is of kind `vm::Ctx`. -/// -/// ``` -/// # use wasmer_runtime_core::{imports, func, vm}; -/// -/// // A host function. -/// fn func(ctx: &mut vm::Ctx, n: i32) -> i32 { -/// n -/// } -/// -/// let import_object = imports! { -/// "env" => { -/// "foo" => func!(func), -/// "bar" => func!(|_: &mut vm::Ctx, n: i32| -> i32 { -/// n + 7 -/// }), -/// }, -/// }; -/// ``` -#[macro_export] -macro_rules! func { - ($function:expr) => { - $crate::typed_func::Func::new($function) - }; -} diff --git a/lib/deprecated/runtime-core/src/global.rs b/lib/deprecated/runtime-core/src/global.rs deleted file mode 100644 index f650b344654..00000000000 --- a/lib/deprecated/runtime-core/src/global.rs +++ /dev/null @@ -1,109 +0,0 @@ -use crate::{ - error::ExportError, - get_global_store, new, - types::{GlobalDescriptor, Value}, -}; -use std::fmt; - -/// A handle to a Wasm Global -#[derive(Clone)] -pub struct Global { - new_global: new::wasmer::Global, -} - -impl Global { - /// Create a new `Global` value. - /// - /// # Example - /// - /// ``` - /// # use wasmer_runtime_core::{global::Global, types::Value}; - /// let global = Global::new(Value::I32(42)); - /// ``` - pub fn new(value: Value) -> Self { - Self { - new_global: new::wasmer::Global::new(&get_global_store(), value), - } - } - - /// Create a new, mutable `Global` value. - /// - /// # Example - /// - /// ``` - /// # use wasmer_runtime_core::{global::Global, types::Value}; - /// let global = Global::new_mutable(Value::I32(42)); - /// ``` - pub fn new_mutable(value: Value) -> Self { - Self { - new_global: new::wasmer::Global::new_mut(&get_global_store(), value), - } - } - - /// Get the [`GlobalDescriptor`] generated for this global. - /// - /// [`GlobalDescriptor`]: struct.GlobalDescriptor.html - pub fn descriptor(&self) -> GlobalDescriptor { - self.new_global.ty().into() - } - - /// Set the value help by this global. - /// - /// This method will panic if the value is - /// the wrong type. - pub fn set(&self, value: Value) { - self.new_global.set(value).unwrap() - } - - /// Get the value held by this global. - /// - /// # Example - /// - /// ``` - /// # use wasmer_runtime_core::{global::Global, types::Value}; - /// let global = Global::new_mutable(Value::I32(42)); - /// assert_eq!(global.get(), Value::I32(42)); - /// - /// global.set(Value::I32(7)); - /// assert_eq!(global.get(), Value::I32(7)); - /// ``` - pub fn get(&self) -> Value { - self.new_global.get() - } -} - -impl fmt::Debug for Global { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "{:?}", &self.new_global) - } -} - -impl From<&new::wasmer::Global> for Global { - fn from(new_global: &new::wasmer::Global) -> Self { - Self { - new_global: new_global.clone(), - } - } -} - -impl<'a> new::wasmer::Exportable<'a> for Global { - fn to_export(&self) -> new::wasmer::Export { - self.new_global.to_export() - } - - fn get_self_from_extern(r#extern: &'a new::wasmer::Extern) -> Result<&'a Self, ExportError> { - match r#extern { - new::wasmer::Extern::Global(global) => Ok( - // It's not ideal to call `Box::leak` here, but it - // would introduce too much changes in the - // `new::wasmer` API to support `Cow` or similar. - Box::leak(Box::::new(global.into())), - ), - _ => Err(ExportError::IncompatibleType), - } - } - - fn into_weak_instance_ref(&mut self) { - self.new_global.into_weak_instance_ref(); - } -} diff --git a/lib/deprecated/runtime-core/src/import.rs b/lib/deprecated/runtime-core/src/import.rs deleted file mode 100644 index 1c2dc88782d..00000000000 --- a/lib/deprecated/runtime-core/src/import.rs +++ /dev/null @@ -1,159 +0,0 @@ -use crate::{instance::Exports, new}; - -pub use new::wasmer::{namespace, ImportObject, ImportObjectIterator, LikeNamespace}; - -pub struct Namespace { - exports: Exports, -} - -impl Namespace { - pub fn new() -> Self { - Self { - exports: Exports::new(), - } - } - - pub fn insert(&mut self, name: N, value: V) - where - N: Into, - V: Into + 'static, - { - self.exports.new_exports.insert(name, value); - } - - pub fn contains_key(&mut self, name: N) -> bool - where - N: Into, - { - self.exports.new_exports.contains(name) - } -} - -impl LikeNamespace for Namespace { - fn get_namespace_export(&self, name: &str) -> Option { - self.exports.new_exports.get_namespace_export(name) - } - - fn get_namespace_exports(&self) -> Vec<(String, new::wasmer::Export)> { - self.exports.new_exports.get_namespace_exports() - } -} - -#[deprecated( - since = "__NEXT_VERSION__", - note = "Please use the `Exportable` trait instead." -)] -pub trait IsExport {} - -/// Generate an `ImportObject` easily with the `imports!` macro. -/// -/// # Usage -/// -/// ``` -/// # use wasmer_runtime_core::{imports, func, vm::Ctx}; -/// -/// let import_object = imports! { -/// "env" => { -/// "foo" => func!(foo) -/// }, -/// }; -/// -/// fn foo(_: &mut Ctx, n: i32) -> i32 { -/// n -/// } -/// ``` -#[macro_export] -macro_rules! imports { - ( $( $namespace_name:expr => $namespace:tt ),* $(,)? ) => { - { - let mut import_object = $crate::import::ImportObject::new(); - - $({ - let namespace = $crate::import_namespace!($namespace); - - import_object.register($namespace_name, namespace); - })* - - import_object - } - }; - - ($state_creator:expr, $( $namespace_name:expr => $namespace:tt ),* $(,)? ) => { - { - compile_error!("State creation in the ImportObject is no longer supported.\nYou can achieve something similar by using Function environments in the Wasmer 1.0 API."); - } - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! import_namespace { - ( { $( $import_name:expr => $import_item:expr ),* $(,)? } ) => { - { - let mut namespace = $crate::import::Namespace::new(); - - $( - namespace.insert($import_name, $import_item); - )* - - namespace - } - }; - - ( $namespace:ident ) => { - $namespace - }; -} - -#[cfg(test)] -mod test { - use crate::{func, vm}; - - fn func(_: &mut vm::Ctx, arg: i32) -> i32 { - arg + 1 - } - - #[test] - fn imports_macro_allows_trailing_comma_and_none() { - let _ = imports! { - "env" => { - "func" => func!(func), - }, - }; - let _ = imports! { - "env" => { - "func" => func!(func), - } - }; - let _ = imports! { - "env" => { - "func" => func!(func), - }, - "abc" => { - "def" => func!(func), - } - }; - let _ = imports! { - "env" => { - "func" => func!(func) - }, - }; - let _ = imports! { - "env" => { - "func" => func!(func) - } - }; - let _ = imports! { - "env" => { - "func1" => func!(func), - "func2" => func!(func) - } - }; - let _ = imports! { - "env" => { - "func1" => func!(func), - "func2" => func!(func), - } - }; - } -} diff --git a/lib/deprecated/runtime-core/src/instance.rs b/lib/deprecated/runtime-core/src/instance.rs deleted file mode 100644 index 64b2f1b6cf2..00000000000 --- a/lib/deprecated/runtime-core/src/instance.rs +++ /dev/null @@ -1,271 +0,0 @@ -use crate::{ - error::ExportError, - export::{Export, Exportable}, - import::LikeNamespace, - module::{ExportIndex, Module}, - new, - structures::TypedIndex, - typed_func::Func, - types::Value, - vm, -}; -use std::{ - error::Error, - sync::{Arc, Mutex, MutexGuard}, -}; - -pub use crate::typed_func::DynamicFunc as DynFunc; - -#[derive(Debug)] -pub(crate) struct PreInstance { - pub(crate) vmctx: Arc>, -} - -impl PreInstance { - pub(crate) fn new() -> Self { - Self { - vmctx: Arc::new(Mutex::new(unsafe { vm::Ctx::new_uninit() })), - } - } - - pub(crate) fn vmctx(&self) -> Arc> { - self.vmctx.clone() - } - - pub(crate) fn vmctx_ptr(&self) -> *mut vm::Ctx { - &mut *self.vmctx.lock().unwrap() as _ - } -} - -/// An instantiated WebAssembly module. -/// -/// An `Instance` represents a WebAssembly module that -/// has been instantiated with an [`ImportObject`] and is -/// ready to be called. -/// -/// [`ImportObject`]: struct.ImportObject.html -pub struct Instance { - pre_instance: Box, - /// The exports of this instance. - pub exports: Exports, - pub(crate) new_instance: new::wasmer::Instance, -} - -impl Instance { - pub(crate) fn new(pre_instance: Box, new_instance: new::wasmer::Instance) -> Self { - // Initialize the `vm::Ctx` - { - let mut vmctx = pre_instance.vmctx.lock().unwrap(); - - vmctx.module_info = new_instance.module().info() as *const _; - } - - Self { - pre_instance, - exports: new_instance.exports.clone().into(), - new_instance, - } - } - - /// Through generic magic and the awe-inspiring power of traits, we bring you... - /// - /// # "Func" - /// - /// A [`Func`] allows you to call functions exported from wasm with - /// near zero overhead. - /// - /// [`Func`]: struct.Func.html - /// - /// # Usage - /// - /// ``` - /// # #![allow(deprecated)] - /// # use wasmer_runtime_core::{Func, Instance, error::ExportError}; - /// # fn typed_func(instance: Instance) -> Result<(), ExportError> { - /// let func: Func<(i32, i32)> = instance.func("foo")?; - /// - /// func.call(42, 43); - /// # Ok(()) - /// # } - /// ``` - #[deprecated( - since = "0.17.0", - note = "Please use `instance.exports.get(name)` instead" - )] - pub fn func(&self, name: &str) -> Result, ExportError> - where - Args: new::wasmer::WasmTypeList + Clone, - Rets: new::wasmer::WasmTypeList + Clone, - { - self.exports.get(name) - } - - /// This returns the representation of a function that can be called - /// safely. - /// - /// # Usage - /// - /// ``` - /// # #![allow(deprecated)] - /// # use wasmer_runtime_core::{Instance}; - /// # fn call_foo(instance: &mut Instance) -> Result<(), Box> { - /// instance - /// .dyn_func("foo")? - /// .call(&[])?; - /// # Ok(()) - /// # } - /// ``` - #[deprecated( - since = "0.17.0", - note = "Please use `instance.exports.get(name)` instead" - )] - pub fn dyn_func(&self, name: &str) -> Result { - self.exports.get(name) - } - - /// Resolve an exported function by name. - pub fn resolve_func(&self, name: &str) -> Result { - self.new_instance - .module() - .info() - .exports - .iter() - .find_map(|(export_name, export_index)| { - if name == export_name { - match export_index { - ExportIndex::Function(index) => Some(index.index()), - _ => None, - } - } else { - None - } - }) - .ok_or(()) - } - - /// Call an exported WebAssembly function given the export name. - /// Pass arguments by wrapping each one in the [`Value`] enum. - /// The returned values are also each wrapped in a [`Value`]. - /// - /// [`Value`]: enum.Value.html - /// - /// # Note - /// - /// This returns `Result, _>` in order to support - /// the future multi-value returns WebAssembly feature. - /// - /// # Usage - /// - /// Consider using the more explicit [`Exports::get`]` with [`DynFunc::call`] - /// instead. For example: - /// - /// ``` - /// # use wasmer_runtime_core::{types::Value, Instance, DynFunc}; - /// # fn call_foo(instance: &mut Instance) -> Result<(), Box> { - /// // … - /// let foo: DynFunc = instance.exports.get("foo")?; - /// let results = foo.call(&[Value::I32(42)])?; - /// // … - /// # Ok(()) - /// # } - /// ``` - /// - /// Another example with `Instance::call` directly: - /// - /// ``` - /// # use wasmer_runtime_core::{types::Value, Instance}; - /// # fn call_foo(instance: &mut Instance) -> Result<(), Box> { - /// // ... - /// let results = instance.call("foo", &[Value::I32(42)])?; - /// // ... - /// # Ok(()) - /// # } - /// ``` - pub fn call(&self, name: &str, params: &[Value]) -> Result, Box> { - Ok(self - .new_instance - .exports - .get_function(name)? - .call(params)? - .into_vec()) - } - - /// The module used to instantiate this Instance. - pub fn module(&self) -> Module { - Module::new(self.new_instance.module().clone()) - } - - /// Returns an immutable reference to the - /// [`Ctx`] used by this Instance. - /// - /// [`Ctx`]: struct.Ctx.html - pub fn context(&self) -> MutexGuard { - self.pre_instance.vmctx.lock().unwrap() - } - - /// Returns a mutable reference to the - /// [`Ctx`] used by this Instance. - /// - /// [`Ctx`]: struct.Ctx.html - pub fn context_mut(&mut self) -> MutexGuard { - self.pre_instance.vmctx.lock().unwrap() - } - - /// Returns an iterator over all of the items - /// exported from this instance. - pub fn exports( - &self, - ) -> new::wasmer::ExportsIterator> { - self.new_instance.exports.iter() - } -} - -impl LikeNamespace for Instance { - fn get_namespace_export(&self, name: &str) -> Option { - self.exports.new_exports.get_namespace_export(name) - } - - fn get_namespace_exports(&self) -> Vec<(String, new::wasmer::Export)> { - self.exports.new_exports.get_namespace_exports() - } -} - -#[derive(Clone)] -pub struct Exports { - pub(crate) new_exports: new::wasmer::Exports, -} - -impl Exports { - pub(crate) fn new() -> Self { - Self { - new_exports: new::wasmer::Exports::new(), - } - } - - pub fn get<'a, T>(&'a self, name: &str) -> Result - where - T: Exportable<'a> + Clone + 'a, - { - Ok(self.new_exports.get::(name)?.clone()) - } - - pub fn iter(&self) -> new::wasmer::ExportsIterator> { - self.new_exports.iter() - } -} - -impl LikeNamespace for Exports { - fn get_namespace_export(&self, name: &str) -> Option { - self.new_exports.get_namespace_export(name) - } - - fn get_namespace_exports(&self) -> Vec<(String, new::wasmer::Export)> { - self.new_exports.get_namespace_exports() - } -} - -impl From for Exports { - fn from(new_exports: new::wasmer::Exports) -> Self { - Self { new_exports } - } -} diff --git a/lib/deprecated/runtime-core/src/lib.rs b/lib/deprecated/runtime-core/src/lib.rs deleted file mode 100644 index 85513d83ab7..00000000000 --- a/lib/deprecated/runtime-core/src/lib.rs +++ /dev/null @@ -1,170 +0,0 @@ -//! Wasmer Runtime Core Library -//! -//! # Important Note; Please Read -//! -//! Wasmer has entirely changed its API (called the “new API” -//! here). This new version of Wasmer improves the performance and the -//! memory consumption, in addition to a ton of new features and much -//! more flexibility! In order to help users to enjoy the performance -//! boost and memory improvements without updating your program that -//! much, we have created a new version of the `wasmer-runtime-core` -//! crate, which is now *a port* of the new API but with the old API, -//! as much as possible. Indeed, it was not always possible to provide -//! the exact same API, but changes are subtle. -//! -//! We have carefully documented most of the differences. It is -//! important to understand the public of this port (see the -//! `CHANGES.md`) document. We do not recommend to advanced users of -//! Wasmer to use this port. Advanced API, like `ModuleInfo` or the -//! `vm` module (incl. `vm::Ctx`) have not been fully ported because -//! it was very internals to Wasmer. For advanced users, we highly -//! recommend to migrate to the new version of Wasmer, which is -//! awesome by the way (completely neutral opinion). The public for -//! this port is beginners or regular users that do not necesarily -//! have time to update their code immediately but that want to enjoy -//! a performance boost and memory improvements. -//! -//! # Introduction -//! -//! This crate provides common data structures which are shared by -//! compiler backends to implement a WebAssembly runtime. -//! -//! This crate also provides an API for users who use wasmer as an -//! embedded wasm runtime which allows operations like compiling, -//! instantiating, providing imports, access exports, memories, and -//! tables for example. -//! -//! Most wasmer users should prefer the API which is re-exported by -//! the `wasmer-runtime` library by default. This crate provides -//! additional APIs which may be useful to users that wish to -//! customize the wasmer runtime. - -pub(crate) mod new { - pub use wasmer; - pub use wasmer_cache; - pub use wasmer_compiler; - #[cfg(feature = "cranelift")] - pub use wasmer_compiler_cranelift; - #[cfg(feature = "llvm")] - pub use wasmer_compiler_llvm; - #[cfg(feature = "singlepass")] - pub use wasmer_compiler_singlepass; - pub use wasmer_engine; - pub use wasmer_engine_universal; - pub use wasmer_types; - pub use wasmer_vm; -} - -pub mod backend; -pub mod cache; -pub mod error; -pub mod export; -mod functional_api; -pub mod global; -pub mod import; -pub mod instance; -pub mod memory; -pub mod module; -pub mod structures; -pub mod table; -pub mod typed_func; -pub mod types; -pub mod units; -pub mod vm; - -pub use crate::cache::{Artifact, WasmHash}; -#[allow(deprecated)] -pub use crate::import::IsExport; -pub use crate::instance::{DynFunc, Exports, Instance}; -pub use crate::module::Module; -pub use crate::new::wasmer_compiler::wasmparser; -pub use crate::typed_func::{DynamicFunc, Func}; -pub use crate::units::{Bytes, Pages, WASM_MAX_PAGES, WASM_MIN_PAGES, WASM_PAGE_SIZE}; -pub use functional_api::{ - compile, compile_with, compile_with_config, load_cache_with, validate, wat2wasm, -}; - -pub mod prelude { - pub use crate::import::{namespace, ImportObject, Namespace}; - pub use crate::typed_func::{DynamicFunc, Func}; - pub use crate::types::{FuncIndex, GlobalIndex, MemoryIndex, TableIndex, Type, Value}; -} - -/// The current version of this crate -pub const VERSION: &'static str = env!("CARGO_PKG_VERSION"); - -use backend::Backend; -use std::sync::{Arc, Mutex}; - -struct GlobalStore { - store: Mutex>, - backend: Backend, -} - -impl GlobalStore { - fn new() -> Self { - Self { - store: Mutex::new(Arc::new(Default::default())), - backend: Backend::Auto, - } - } - - fn renew_with(&self, compiler: backend::Backend) { - if compiler == self.backend { - return; - } - - #[allow(unused_variables)] - let update = |engine: new::wasmer_engine_universal::Universal, - global_store: &GlobalStore| { - let engine = engine.engine(); - *self.store.lock().unwrap() = Arc::new(new::wasmer::Store::new(&engine)); - }; - - match compiler { - #[cfg(feature = "singlepass")] - Backend::Singlepass => update( - new::wasmer_engine_universal::Universal::new( - new::wasmer_compiler_singlepass::Singlepass::default(), - ), - &self, - ), - - #[cfg(feature = "cranelift")] - Backend::Cranelift => update( - new::wasmer_engine_universal::Universal::new( - new::wasmer_compiler_cranelift::Cranelift::default(), - ), - &self, - ), - - #[cfg(feature = "llvm")] - Backend::LLVM => update( - new::wasmer_engine_universal::Universal::new( - new::wasmer_compiler_llvm::LLVM::default(), - ), - &self, - ), - - Backend::Auto => *self.store.lock().unwrap() = Arc::new(Default::default()), - }; - } - - fn inner_store(&self) -> Arc { - (*self.store.lock().unwrap()).clone() - } -} - -lazy_static::lazy_static! { - static ref GLOBAL_STORE: GlobalStore = GlobalStore::new(); -} - -/// Useful if one needs to update the global store. -pub(crate) fn renew_global_store_with(backend: Backend) { - GLOBAL_STORE.renew_with(backend); -} - -/// Useful if one needs to migrate to the new Wasmer's API gently. -pub fn get_global_store() -> Arc { - GLOBAL_STORE.inner_store() -} diff --git a/lib/deprecated/runtime-core/src/memory.rs b/lib/deprecated/runtime-core/src/memory.rs deleted file mode 100644 index 915630b3db3..00000000000 --- a/lib/deprecated/runtime-core/src/memory.rs +++ /dev/null @@ -1,143 +0,0 @@ -use crate::{ - error::{ExportError, MemoryError}, - get_global_store, new, - types::ValueType, - units::Pages, -}; - -pub mod ptr { - pub use crate::new::wasmer::{Array, Item, WasmPtr}; -} - -pub use new::wasmer::{Atomically, MemoryView}; -pub use new::wasmer_types::MemoryType as MemoryDescriptor; -pub use new::wasmer_vm::MemoryStyle as MemoryType; - -/// A Wasm linear memory. -/// -/// A `Memory` represents the memory used by a Wasm instance. -#[derive(Clone)] -pub struct Memory { - new_memory: new::wasmer::Memory, -} - -impl Memory { - /// Create a new `Memory` from a [`MemoryDescriptor`] - /// - /// [`MemoryDescriptor`]: struct.MemoryDescriptor.html - /// - /// Usage: - /// - /// ``` - /// # use wasmer_runtime_core::{types::MemoryDescriptor, error::MemoryError, memory::Memory, units::Pages}; - /// fn create_memory() -> Result<(), MemoryError> { - /// let descriptor = MemoryDescriptor::new(Pages(10), None, false); - /// - /// let memory = Memory::new(descriptor)?; - /// Ok(()) - /// } - /// ``` - pub fn new(descriptor: MemoryDescriptor) -> Result { - Ok(Memory { - new_memory: new::wasmer::Memory::new(&get_global_store(), descriptor)?, - }) - } - - /// Return the [`MemoryDescriptor`] that this memory - /// was created with. - /// - /// [`MemoryDescriptor`]: struct.MemoryDescriptor.html - pub fn descriptor(&self) -> MemoryDescriptor { - self.new_memory.ty().clone() - } - - /// Grow this memory by the specified number of pages. - pub fn grow(&self, delta: Pages) -> Result { - self.new_memory.grow(delta) - } - - /// The size, in wasm pages, of this memory. - pub fn size(&self) -> Pages { - self.new_memory.size() - } - - /// Return a "view" of the currently accessible memory. By - /// default, the view is unsynchronized, using regular memory - /// accesses. You can force a memory view to use atomic accesses - /// by calling the [`atomically`] method. - /// - /// [`atomically`]: struct.MemoryView.html#method.atomically - /// - /// # Notes - /// - /// This method is safe (as in, it won't cause the host to crash or have UB), - /// but it doesn't obey rust's rules involving data races, especially concurrent ones. - /// Therefore, if this memory is shared between multiple threads, a single memory - /// location can be mutated concurrently without synchronization. - /// - /// # Usage - /// - /// ``` - /// # use wasmer_runtime_core::memory::{Memory, MemoryView}; - /// # use std::{cell::Cell, sync::atomic::Ordering}; - /// # fn view_memory(memory: Memory) { - /// // Without synchronization. - /// let view: MemoryView = memory.view(); - /// for byte in view[0x1000 .. 0x1010].iter().map(Cell::get) { - /// println!("byte: {}", byte); - /// } - /// - /// // With synchronization. - /// let atomic_view = view.atomically(); - /// for byte in atomic_view[0x1000 .. 0x1010].iter().map(|atom| atom.load(Ordering::SeqCst)) { - /// println!("byte: {}", byte); - /// } - /// # } - /// ``` - pub fn view(&self) -> MemoryView { - self.new_memory.view() - } -} - -impl From<&new::wasmer::Memory> for Memory { - fn from(new_memory: &new::wasmer::Memory) -> Self { - Self { - new_memory: new_memory.clone(), - } - } -} - -impl<'a> new::wasmer::Exportable<'a> for Memory { - fn to_export(&self) -> new::wasmer::Export { - self.new_memory.to_export() - } - - fn get_self_from_extern(r#extern: &'a new::wasmer::Extern) -> Result<&'a Self, ExportError> { - match r#extern { - new::wasmer::Extern::Memory(memory) => Ok( - // It's not ideal to call `Box::leak` here, but it - // would introduce too much changes in the - // `new::wasmer` API to support `Cow` or similar. - Box::leak(Box::::new(memory.into())), - ), - _ => Err(ExportError::IncompatibleType), - } - } - - fn into_weak_instance_ref(&mut self) { - self.new_memory.into_weak_instance_ref(); - } -} - -#[cfg(test)] -mod memory_tests { - use super::{Memory, MemoryDescriptor, Pages}; - - #[test] - fn test_initial_memory_size() { - let memory_desc = MemoryDescriptor::new(Pages(10), Some(Pages(20)), false); - let unshared_memory = Memory::new(memory_desc).unwrap(); - - assert_eq!(unshared_memory.size(), Pages(10)); - } -} diff --git a/lib/deprecated/runtime-core/src/module.rs b/lib/deprecated/runtime-core/src/module.rs deleted file mode 100644 index 7bcd9b6d5d5..00000000000 --- a/lib/deprecated/runtime-core/src/module.rs +++ /dev/null @@ -1,249 +0,0 @@ -use crate::{ - cache::Artifact, - error::{InstantiationError, RuntimeError}, - import::{ImportObject, Namespace}, - instance::{Instance, PreInstance}, - new, - typed_func::DynamicCtx, - types::{FuncSig, Value}, - vm, -}; -use new::wasmer::Export; -use std::{ - collections::HashMap, - convert::{AsRef, Infallible}, - ptr, - sync::{Arc, Mutex}, -}; - -pub use new::wasmer_types::{DataInitializer, ExportIndex, TableInitializer}; -pub use new::wasmer_vm::{ - // - MemoryStyle as MemoryType, - ModuleInfo, -}; - -/// A compiled WebAssembly module. -/// -/// `Module` is returned by the [`compile`] function. -/// -/// [`compile`]: crate::compile -#[derive(Clone)] -pub struct Module { - pub(crate) new_module: new::wasmer::Module, -} - -impl Module { - pub(crate) fn new(new_module: new::wasmer::Module) -> Self { - Self { new_module } - } - - /// Instantiate a WebAssembly module with the provided [`ImportObject`]. - /// - /// [`ImportObject`]: struct.ImportObject.html - /// - /// # Note - /// - /// Instantiating a `Module` will also call the function designated as `start` - /// in the WebAssembly module, if there is one. - /// - /// # Usage - /// - /// ``` - /// # use wasmer_runtime_core::{Module, imports, error::InstantiationError}; - /// # fn instantiate(module: &Module) -> Result<(), InstantiationError> { - /// let import_object = imports! { - /// // ... - /// }; - /// let instance = module.instantiate(&import_object)?; - /// // ... - /// # Ok(()) - /// # } - /// ``` - pub fn instantiate( - &self, - import_object: &ImportObject, - ) -> Result { - let pre_instance = Box::new(PreInstance::new()); - - let import_object = { - // The problem is the following: - // - // * In the old API, `Instance` owns the host functions' - // environments of kind `vm::Ctx`, and mutably shares it - // with all host functions. - // * In the new API, every host function owns its env of - // any kind; `Instance` knows nothing about this - // environment. - // - // To reproduce the old API with the new API, host - // functions create an empty environment of kind - // `vm::Ctx`. It is stored internally behind a `VMContext` - // pointer. The hack consists of rebuilding an - // `ImportObject` (that holds all the host functions), and - // updates the `VMContext` pointer to use a shared - // `vm::Ctx` value owned by `Instance` (actually, - // `PreInstance`). - - let mut new_import_object = ImportObject::new(); - let mut new_namespaces: HashMap = HashMap::new(); - let store = self.new_module.store(); - - import_object - .clone() - .into_iter() - .map(|((namespace, name), export)| match export { - Export::Function(mut function) => { - { - // `function` is a static host function - // constructed with - // `new::wasmer::Function::new_env`. - if !function.vm_function.address.is_null() { - // Properly drop the empty `vm::Ctx` - // created by the host function. - unsafe { - ptr::drop_in_place::( - function.vm_function.vmctx.host_env as _, - ); - } - - // Update the pointer to `VMContext`, - // which is actually a `vm::Ctx` - // pointer, to fallback on the - // environment hack. - function.vm_function.vmctx.host_env = pre_instance.vmctx_ptr() as _; - } - // `function` is a dynamic host function - // constructed with - // `new::wasmer::Function::new_dynamic_env`. - else { - // `VMContext` holds a complex type: - // `Box>>`. - // - // The type `VMDynamicFunctionWithEnv` - // is private to `new::wasmer`. Let's - // replicate it, and hope the layout - // is the same! - struct VMDynamicFunctionWithEnv - where - Env: Sized + 'static + Send + Sync, - { - #[allow(unused)] - function_type: FuncSig, - #[allow(unused)] - func: Arc< - dyn Fn( - &mut Env, - &[Value], - ) - -> Result, RuntimeError> - + 'static - + Send - + Sync, - >, - env: Box>, - } - - // Get back the `vmctx` as it is - // stored by - // `new::wasmer::Function::new_dynamic_env`. - let vmctx: Box< - new::wasmer_vm::VMDynamicFunctionContext< - VMDynamicFunctionWithEnv, - >, - > = unsafe { - Box::from_raw(function.vm_function.vmctx.host_env as *mut _) - }; - - // Replace the environment by ours. - { - let mut guard = vmctx.ctx.env.lock().unwrap(); - guard.vmctx = pre_instance.vmctx(); - } - - // … without anyone noticing… - function.vm_function.vmctx.host_env = Box::into_raw(vmctx) as _; - } - } - - ( - (namespace, name), - new::wasmer::Extern::from_vm_export(store, Export::Function(function)), - ) - } - export => ( - (namespace, name), - new::wasmer::Extern::from_vm_export(store, export), - ), - }) - .for_each(|((namespace, name), extern_)| { - if !new_namespaces.contains_key(&namespace) { - new_namespaces.insert(namespace.clone(), Namespace::new()); - } - - let new_namespace = new_namespaces.get_mut(&namespace).unwrap(); // it is safe because it has been verified that the key exists. - new_namespace.insert(&name, extern_); - }); - - new_namespaces - .into_iter() - .for_each(|(namespace_name, namespace)| { - new_import_object.register(namespace_name, namespace); - }); - - new_import_object - }; - - Ok(Instance::new( - pre_instance, - new::wasmer::Instance::new(&self.new_module, &import_object)?, - )) - } - - /// Create a cache artifact from this module. - pub fn cache(&self) -> Result { - Ok(Artifact::new(self.new_module.clone())) - } - - /// Get the module data for this module. - pub fn info(&self) -> &ModuleInfo { - &self.new_module.info() - } - - /// Get the [`ImportDescriptor`]s describing the imports this [`Module`] - /// requires to be instantiated. - pub fn imports(&self) -> Vec { - self.new_module.imports().collect() - } - - /// Get the [`ExportDescriptor`]s of the exports this [`Module`] provides. - pub fn exports(&self) -> Vec { - self.new_module.exports().collect() - } - - /// Get the custom sections matching the given name. - pub fn custom_sections(&self, name: impl AsRef) -> Option>> { - let custom_sections: Vec> = self - .new_module - .custom_sections(name.as_ref()) - .map(|custom_section| custom_section.to_vec()) - .collect(); - - if custom_sections.is_empty() { - None - } else { - Some(custom_sections) - } - } - - #[doc(hidden)] - pub fn into_inner(&self) -> new::wasmer::Module { - self.new_module.clone() - } -} - -impl Into for Module { - fn into(self) -> new::wasmer::Module { - self.into_inner() - } -} diff --git a/lib/deprecated/runtime-core/src/structures.rs b/lib/deprecated/runtime-core/src/structures.rs deleted file mode 100644 index 43e3e9641a5..00000000000 --- a/lib/deprecated/runtime-core/src/structures.rs +++ /dev/null @@ -1 +0,0 @@ -pub use crate::new::wasmer_types::entity::EntityRef as TypedIndex; diff --git a/lib/deprecated/runtime-core/src/table.rs b/lib/deprecated/runtime-core/src/table.rs deleted file mode 100644 index a9630197922..00000000000 --- a/lib/deprecated/runtime-core/src/table.rs +++ /dev/null @@ -1,112 +0,0 @@ -use crate::{ - error::{ExportError, RuntimeError}, - get_global_store, new, - types::{TableDescriptor, Value}, -}; - -/// Container with a descriptor and a reference to a table storage. -#[derive(Clone)] -pub struct Table { - new_table: new::wasmer::Table, -} - -impl Table { - /// Create a new `Table` from a [`TableDescriptor`] - /// - /// [`TableDescriptor`]: struct.TableDescriptor.html - /// - /// # Usage - /// - /// ``` - /// # use wasmer_runtime_core::{types::{TableDescriptor, Type, Value}, table::Table, error::RuntimeError}; - /// # fn create_table() -> Result<(), RuntimeError> { - /// let descriptor = TableDescriptor { - /// ty: Type::ExternRef, - /// minimum: 10, - /// maximum: None, - /// }; - /// - /// let table = Table::new(descriptor, Value::null())?; - /// # Ok(()) - /// # } - /// ``` - pub fn new(descriptor: TableDescriptor, initial_value: Value) -> Result { - Ok(Self { - new_table: new::wasmer::Table::new(&get_global_store(), descriptor, initial_value)?, - }) - } - - /// Get the `TableDescriptor` used to create this `Table`. - pub fn descriptor(&self) -> TableDescriptor { - self.new_table.ty().clone() - } - - /// Set the element at index. - pub fn set(&self, index: u32, value: Value) -> Result<(), RuntimeError> { - self.new_table.set(index, value) - } - - pub fn get(&self, index: u32) -> Option { - self.new_table.get(index) - } - - /// The current size of this table. - pub fn size(&self) -> u32 { - self.new_table.size() - } - - /// Grow this table by `delta`. - pub fn grow(&self, delta: u32, initial_value: Value) -> Result { - self.new_table.grow(delta, initial_value) - } -} - -impl From<&new::wasmer::Table> for Table { - fn from(new_table: &new::wasmer::Table) -> Self { - Self { - new_table: new_table.clone(), - } - } -} - -impl<'a> new::wasmer::Exportable<'a> for Table { - fn to_export(&self) -> new::wasmer::Export { - self.new_table.to_export() - } - - fn get_self_from_extern(r#extern: &'a new::wasmer::Extern) -> Result<&'a Self, ExportError> { - match r#extern { - new::wasmer::Extern::Table(table) => Ok( - // It's not ideal to call `Box::leak` here, but it - // would introduce too much changes in the - // `new::wasmer` API to support `Cow` or similar. - Box::leak(Box::::new(table.into())), - ), - _ => Err(ExportError::IncompatibleType), - } - } - - fn into_weak_instance_ref(&mut self) { - self.new_table.into_weak_instance_ref(); - } -} - -#[cfg(test)] -mod table_tests { - use super::{Table, TableDescriptor}; - use crate::types::{Type, Value}; - - #[test] - fn test_initial_table_size() { - let table = Table::new( - TableDescriptor { - ty: Type::FuncRef, - minimum: 10, - maximum: Some(20), - }, - Value::FuncRef(None), - ) - .unwrap(); - assert_eq!(table.size(), 10); - } -} diff --git a/lib/deprecated/runtime-core/src/typed_func.rs b/lib/deprecated/runtime-core/src/typed_func.rs deleted file mode 100644 index 702232d2d4f..00000000000 --- a/lib/deprecated/runtime-core/src/typed_func.rs +++ /dev/null @@ -1,420 +0,0 @@ -use crate::{ - error::{ExportError, RuntimeError}, - get_global_store, new, - types::{FuncSig, NativeWasmType, Type, Value, WasmExternType}, - vm, -}; -use std::marker::PhantomData; - -pub use new::wasmer::internals::UnsafeMutableEnv; -pub use new::wasmer::{HostFunction, WasmTypeList, WasmerEnv}; - -/// Represents a function that can be used by WebAssembly. -#[derive(Clone)] -pub struct Func -where - Args: WasmTypeList, - Rets: WasmTypeList, -{ - new_function: new::wasmer::Function, - _phantom: PhantomData<(Args, Rets)>, -} - -impl Func -where - Args: WasmTypeList, - Rets: WasmTypeList, -{ - /// Creates a new `Func`. - pub fn new(func: F) -> Self - where - F: HostFunction + Send, - { - // Create an empty `vm::Ctx`, that is going to be overwritten by `Instance::new`. - let ctx = unsafe { vm::Ctx::new_uninit() }; - - Self { - new_function: unsafe { - new::wasmer::Function::new_native_with_unsafe_mutable_env::( - &get_global_store(), - ctx, - func, - ) - }, - _phantom: PhantomData, - } - } - - /// Returns the full function signature. - pub fn signature(&self) -> &FuncSig { - self.new_function.ty() - } - - /// Returns the types of the function inputs. - pub fn params(&self) -> &[Type] { - self.signature().params() - } - - /// Returns the types of the function outputs. - pub fn returns(&self) -> &[Type] { - self.signature().results() - } - - /// Call the function by passing all arguments in a slice of `Value`. - pub fn dyn_call(&self, params: &[Value]) -> Result, RuntimeError> { - self.new_function.call(params) - } -} - -pub unsafe trait WasmExternTypeInner: WasmExternType -where - Self: Sized, -{ -} - -unsafe impl WasmExternTypeInner for i8 {} -unsafe impl WasmExternTypeInner for u8 {} -unsafe impl WasmExternTypeInner for i16 {} -unsafe impl WasmExternTypeInner for u16 {} -unsafe impl WasmExternTypeInner for i32 {} -unsafe impl WasmExternTypeInner for u32 {} -unsafe impl WasmExternTypeInner for i64 {} -unsafe impl WasmExternTypeInner for u64 {} -unsafe impl WasmExternTypeInner for f32 {} -unsafe impl WasmExternTypeInner for f64 {} - -macro_rules! func_call { - ( $( $x:ident ),* ) => { - #[allow(unused_parens)] - impl< $( $x, )* Rets: WasmTypeList > Func<( $( $x ),* ), Rets> - where - $( $x: WasmExternType + WasmExternTypeInner, )* - Rets: WasmTypeList - { - /// Call the function. - #[allow(non_snake_case, clippy::too_many_arguments)] - pub fn call(&self, $( $x: $x, )* ) -> Result { - // Two implementation choices: - // 1. Either by using the `NativeFunc` API, but a - // new native function must be created for each - // call, - // 2. Pack the parameters into a slice, call - // `dyn_call` with it, and unpack the results. - // - // The first implementation is the following: - // - // self.new_function.native::<( $( $x ),* ), Rets>().unwrap().call( $( $x ),* ) - // - // The second implementation is the following active one: - - // Pack the argument into a slice. - let params: &[Value] = &[ - $( - $x.to_native().to_value() - ),* - ]; - - // Call the function with `dyn_call`, and transform the results into a vector. - let results: Vec = self.dyn_call(params)?.to_vec(); - - // Map the results into their binary form. - let rets: Vec = results - .iter() - .map(|value| { - Ok(match value { - Value::I32(value) => ::from_native(*value).to_binary(), - Value::I64(value) => ::from_native(*value).to_binary(), - Value::F32(value) => ::from_native(*value).to_binary(), - Value::F64(value) => ::from_native(*value).to_binary(), - value => return Err(RuntimeError::new(format!( - "value `{:?}` is not supported as a returned value of a host function for the moment; please use `dyn_call` or the new API", - value - ))), - }) - }) - .collect::>()?; - - // Convert `Vec` into a `WasmTypeList`. - let rets: Rets = Rets::from_slice(rets.as_slice()).map_err(|_| { - RuntimeError::new(format!( - "returned values (`{:?}`) do not match the expected returned type (`{:?}`)", - results, - Rets::wasm_types() - )) - })?; - - Ok(rets) - } - } - } -} - -func_call!(); -func_call!(A1); -func_call!(A1, A2); -func_call!(A1, A2, A3); -func_call!(A1, A2, A3, A4); -func_call!(A1, A2, A3, A4, A5); -func_call!(A1, A2, A3, A4, A5, A6); -func_call!(A1, A2, A3, A4, A5, A6, A7); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18); -func_call!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19); -func_call!( - A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20 -); - -impl From> for new::wasmer::Extern -where - Args: WasmTypeList, - Rets: WasmTypeList, -{ - fn from(func: Func) -> Self { - new::wasmer::Extern::Function(func.new_function) - } -} - -impl From<&new::wasmer::Function> for Func -where - Args: WasmTypeList, - Rets: WasmTypeList, -{ - fn from(new_function: &new::wasmer::Function) -> Self { - Self { - new_function: new_function.clone(), - _phantom: PhantomData, - } - } -} - -impl<'a, Args, Rets> new::wasmer::Exportable<'a> for Func -where - Args: WasmTypeList, - Rets: WasmTypeList, -{ - fn to_export(&self) -> new::wasmer::Export { - self.new_function.to_export() - } - - fn get_self_from_extern(r#extern: &'a new::wasmer::Extern) -> Result<&'a Self, ExportError> { - match r#extern { - new::wasmer::Extern::Function(func) => Ok( - // It's not ideal to call `Box::leak` here, but it - // would introduce too much changes in the - // `new::wasmer` API to support `Cow` or similar. - Box::leak(Box::>::new(func.into())), - ), - _ => Err(ExportError::IncompatibleType), - } - } - - fn into_weak_instance_ref(&mut self) { - self.new_function.into_weak_instance_ref(); - } -} - -/// Represents a type-erased function provided by either the host or the WebAssembly program. -#[derive(Clone)] -pub struct DynamicFunc { - new_function: new::wasmer::Function, -} - -use std::sync::{Arc, Mutex, MutexGuard}; - -/// Specific context for `DynamicFunc`. It's a hack. -/// -/// Initially, it holds an empty `vm::Ctx`, but it is replaced by the -/// `vm::Ctx` from `instance::PreInstance` in -/// `module::Module::instantiate`. -#[derive(WasmerEnv, Clone)] -pub(crate) struct DynamicCtx { - pub(crate) vmctx: Arc>, - inner_func: Arc< - dyn Fn(&mut vm::Ctx, &[Value]) -> Result, RuntimeError> + Send + Sync + 'static, - >, -} - -impl DynamicFunc { - /// Create a new `DynamicFunc`. - pub fn new(signature: &FuncSig, func: F) -> Self - where - F: Fn(&mut vm::Ctx, &[Value]) -> Result, RuntimeError> + Send + Sync + 'static, - { - // Create an empty `vm::Ctx`, that is going to be overwritten by `Instance::new`. - let ctx = DynamicCtx { - vmctx: Arc::new(Mutex::new(unsafe { vm::Ctx::new_uninit() })), - inner_func: Arc::new(func), - }; - - // Wrapper to safely extract a `&mut vm::Ctx` to pass - // to `func`. - fn inner(dyn_ctx: &DynamicCtx, params: &[Value]) -> Result, RuntimeError> { - let cell: Arc> = dyn_ctx.vmctx.clone(); - let mut vmctx: MutexGuard = cell.lock().unwrap(); - - (dyn_ctx.inner_func)(&mut *vmctx, params) - } - - Self { - new_function: new::wasmer::Function::new_with_env::< - _, - fn(&DynamicCtx, &[Value]) -> Result, RuntimeError>, - DynamicCtx, - >(&get_global_store(), signature, ctx, inner), - } - } - - /// Returns the full function signature. - pub fn signature(&self) -> &FuncSig { - self.new_function.ty() - } - - /// Returns the types of the function inputs. - pub fn params(&self) -> &[Type] { - self.signature().params() - } - - /// Returns the types of the function outputs. - pub fn returns(&self) -> &[Type] { - self.signature().results() - } - - /// Call the function. In this case, it's an alias to `dyn_call`. - pub fn call(&self, params: &[Value]) -> Result, RuntimeError> { - self.dyn_call(params) - } - - /// Call the function. - pub fn dyn_call(&self, params: &[Value]) -> Result, RuntimeError> { - self.new_function.call(params) - } -} - -impl From for new::wasmer::Extern { - fn from(dynamic_func: DynamicFunc) -> Self { - new::wasmer::Extern::Function(dynamic_func.new_function) - } -} - -impl From<&new::wasmer::Function> for DynamicFunc { - fn from(new_function: &new::wasmer::Function) -> Self { - Self { - new_function: new_function.clone(), - } - } -} - -impl<'a> new::wasmer::Exportable<'a> for DynamicFunc { - fn to_export(&self) -> new::wasmer::Export { - self.new_function.to_export() - } - - fn get_self_from_extern(r#extern: &'a new::wasmer::Extern) -> Result<&'a Self, ExportError> { - match r#extern { - new::wasmer::Extern::Function(dynamic_func) => Ok( - // It's not ideal to call `Box::leak` here, but it - // would introduce too much changes in the - // `new::wasmer` API to support `Cow` or similar. - Box::leak(Box::::new(dynamic_func.into())), - ), - _ => Err(ExportError::IncompatibleType), - } - } - - fn into_weak_instance_ref(&mut self) { - self.new_function.into_weak_instance_ref(); - } -} - -#[cfg(test)] -mod tests { - use super::*; - - macro_rules! test_func_arity_n { - ($test_name:ident, $($x:ident),*) => { - #[test] - fn $test_name() { - use crate::vm; - - fn with_vmctx(_: &mut vm::Ctx, $($x: i32),*) -> i32 { - vec![$($x),*].iter().sum() - } - - let _ = Func::new(with_vmctx); - let _ = Func::new(|_: &mut vm::Ctx, $($x: i32),*| -> i32 { - vec![$($x),*].iter().sum() - }); - } - } - } - - #[test] - fn test_func_arity_0() { - fn foo(_: &mut vm::Ctx) -> i32 { - 0 - } - - let _ = Func::new(foo); - let _ = Func::new(|_: &mut vm::Ctx| -> i32 { 0 }); - } - - test_func_arity_n!(test_func_arity_1, a); - test_func_arity_n!(test_func_arity_2, a, b); - test_func_arity_n!(test_func_arity_3, a, b, c); - test_func_arity_n!(test_func_arity_4, a, b, c, d); - test_func_arity_n!(test_func_arity_5, a, b, c, d, e); - test_func_arity_n!(test_func_arity_6, a, b, c, d, e, f); - test_func_arity_n!(test_func_arity_7, a, b, c, d, e, f, g); - test_func_arity_n!(test_func_arity_8, a, b, c, d, e, f, g, h); - test_func_arity_n!(test_func_arity_9, a, b, c, d, e, f, g, h, i); - test_func_arity_n!(test_func_arity_10, a, b, c, d, e, f, g, h, i, j); - test_func_arity_n!(test_func_arity_11, a, b, c, d, e, f, g, h, i, j, k); - test_func_arity_n!(test_func_arity_12, a, b, c, d, e, f, g, h, i, j, k, l); - test_func_arity_n!(test_func_arity_13, a, b, c, d, e, f, g, h, i, j, k, l, m); - test_func_arity_n!(test_func_arity_14, a, b, c, d, e, f, g, h, i, j, k, l, m, n); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_15, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_16, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_17, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_18, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_19, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_20, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_21, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_22, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_23, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_24, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_25, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y); - #[rustfmt::skip] test_func_arity_n!(test_func_arity_26, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z); - - #[test] - fn test_call() { - fn foo(_ctx: &mut vm::Ctx, a: i32, b: i32) -> (i32, i32) { - (a, b) - } - - let _f = Func::new(foo); - } - - #[test] - fn test_imports() { - use crate::{func, imports}; - - fn foo(_ctx: &mut vm::Ctx, a: i32) -> i32 { - a - } - - let _import_object = imports! { - "env" => { - "foo" => func!(foo), - }, - }; - } -} diff --git a/lib/deprecated/runtime-core/src/types.rs b/lib/deprecated/runtime-core/src/types.rs deleted file mode 100644 index 3b32941e65a..00000000000 --- a/lib/deprecated/runtime-core/src/types.rs +++ /dev/null @@ -1,99 +0,0 @@ -use crate::new; - -pub use new::wasmer::{FromToNativeWasmType as WasmExternType, Val as Value}; -pub use new::wasmer_types::{ - // - ExportType as ExportDescriptor, - ExternType as ExternDescriptor, - FunctionIndex as FuncIndex, - FunctionIndex as ImportedFuncIndex, - FunctionType as FuncDescriptor, - FunctionType as FuncSig, - GlobalIndex as ImportedGlobalIndex, - GlobalIndex, - GlobalInit, - ImportType as ImportDescriptor, - LocalFunctionIndex as LocalFuncIndex, - LocalGlobalIndex, - LocalMemoryIndex, - LocalTableIndex, - MemoryIndex as ImportedMemoryIndex, - MemoryIndex, - MemoryType as MemoryDescriptor, - NativeWasmType, - SignatureIndex as SigIndex, - TableIndex as ImportedTableIndex, - TableIndex, - TableType as TableDescriptor, - Type, - ValueType, -}; - -/// Describes the mutability and type of a Global -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub struct GlobalDescriptor { - pub mutable: bool, - pub ty: Type, -} - -impl From<&new::wasmer_types::GlobalType> for GlobalDescriptor { - fn from(value: &new::wasmer_types::GlobalType) -> Self { - Self { - mutable: value.mutability.into(), - ty: value.ty, - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_native_types_round_trip() { - assert_eq!( - 42i32, - i32::from_native(i32::from_binary((42i32).to_native().to_binary())) - ); - - assert_eq!( - -42i32, - i32::from_native(i32::from_binary((-42i32).to_native().to_binary())) - ); - - use std::i64; - let xi64 = i64::MAX; - assert_eq!( - xi64, - i64::from_native(i64::from_binary((xi64).to_native().to_binary())) - ); - let yi64 = i64::MIN; - assert_eq!( - yi64, - i64::from_native(i64::from_binary((yi64).to_native().to_binary())) - ); - - assert_eq!( - 16.5f32, - f32::from_native(f32::from_binary((16.5f32).to_native().to_binary())) - ); - - assert_eq!( - -16.5f32, - f32::from_native(f32::from_binary((-16.5f32).to_native().to_binary())) - ); - - use std::f64; - let xf64: f64 = f64::MAX; - assert_eq!( - xf64, - f64::from_native(f64::from_binary((xf64).to_native().to_binary())) - ); - - let yf64: f64 = f64::MIN; - assert_eq!( - yf64, - f64::from_native(f64::from_binary((yf64).to_native().to_binary())) - ); - } -} diff --git a/lib/deprecated/runtime-core/src/units.rs b/lib/deprecated/runtime-core/src/units.rs deleted file mode 100644 index f95bb8e29a1..00000000000 --- a/lib/deprecated/runtime-core/src/units.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::new; - -pub use new::wasmer_types::{ - // - Bytes, - Pages, - WASM_MAX_PAGES, - WASM_MIN_PAGES, - WASM_PAGE_SIZE, -}; diff --git a/lib/deprecated/runtime-core/src/vm.rs b/lib/deprecated/runtime-core/src/vm.rs deleted file mode 100644 index 8fd9df8b111..00000000000 --- a/lib/deprecated/runtime-core/src/vm.rs +++ /dev/null @@ -1,92 +0,0 @@ -use crate::{module::ModuleInfo, new}; -use new::wasmer::WasmerEnv; -use std::{ffi::c_void, ptr}; - -use new::wasmer::internals::UnsafeMutableEnv; - -/// The context of the currently running WebAssembly instance. -/// -/// This is implicitly passed to every WebAssembly function. -/// Since this is per-instance, each field has a statically -/// (as in after compiling the wasm) known size, so no -/// runtime checks are necessary. -/// -/// While the runtime currently just passes this around -/// as the first, implicit parameter of every function, -/// it may someday be pinned to a register (especially -/// on arm, which has a ton of registers) to reduce -/// register shuffling. -#[derive(Debug, Clone, WasmerEnv)] -#[repr(C)] -pub struct Ctx { - /// A pointer to the `ModuleInfo` of this instance. - pub module_info: *const ModuleInfo, - - /// This is intended to be user-supplied, per-instance - /// contextual data. There are currently some issue with it, - /// notably that it cannot be set before running the `start` - /// function in a WebAssembly module. Additionally, the `data` - /// field may be taken by another ABI implementation that the user - /// wishes to use in addition to their own, such as WASI. This issue is - /// being discussed at [#1111](https://github.com/wasmerio/wasmer/pull/1111). - /// - /// Alternatively, per-function data can be used if the function in the - /// [`ImportObject`] is a closure. This cannot duplicate data though, - /// so if data may be shared if the [`ImportObject`] is reused. - pub data: *mut c_void, - - /// If there's a function set in this field, it gets called - /// when the context is destructed, e.g. when an `Instance` - /// is dropped. - pub data_finalizer: Option, -} - -/// We mark `Ctx` as a legacy env that can be passed by `&mut`. -unsafe impl UnsafeMutableEnv for Ctx {} -/// This is correct because of the way we use the data in `Ctx`; -/// it's not correct in general though, so we should be careful when -/// updating this type. -unsafe impl Send for Ctx {} -unsafe impl Sync for Ctx {} - -impl Ctx { - pub(crate) unsafe fn new_uninit() -> Self { - Self { - module_info: ptr::null(), - data: ptr::null_mut(), - data_finalizer: None, - } - } -} - -impl Drop for Ctx { - fn drop(&mut self) { - if let Some(ref finalizer) = self.data_finalizer { - finalizer(self.data); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::mem::forget; - - #[test] - fn test_callback_on_drop() { - let foo = String::from("foo"); - let mut ctx = unsafe { Ctx::new_uninit() }; - - ctx.data = foo.as_ptr() as *const _ as *mut _; - ctx.data_finalizer = Some(|data| { - let foo = unsafe { String::from_raw_parts(data as *mut _, 3, 3) }; - - assert_eq!(String::from("foo"), foo); - - drop(foo); - }); - - drop(ctx); - forget(foo); - } -} diff --git a/lib/deprecated/runtime/.empty b/lib/deprecated/runtime/.empty deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/lib/deprecated/runtime/Cargo.lock b/lib/deprecated/runtime/Cargo.lock deleted file mode 100644 index e37d6a70c21..00000000000 --- a/lib/deprecated/runtime/Cargo.lock +++ /dev/null @@ -1,1460 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" -dependencies = [ - "gimli 0.22.0", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "backtrace" -version = "0.3.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" -dependencies = [ - "addr2line", - "cfg-if 0.1.10", - "libc", - "miniz_oxide", - "object 0.20.0", - "rustc-demangle", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "blake3" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f88a20f7dc23e3896bcbd85add056543c87215de721468b90e0c85d5a9f365" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac", - "digest", -] - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "cc" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - -[[package]] -name = "const_fn" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cranelift-bforest" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ca3560686e7c9c7ed7e0fe77469f2410ba5d7781b1acaa9adc8d8deea28e3e" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf9bf1ffffb6ce3d2e5ebc83549bd2436426c99b31cc550d521364cbe35d276" -dependencies = [ - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "gimli 0.24.0", - "log", - "regalloc", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc21936a5a6d07e23849ffe83e5c1f6f50305c074f4b2970ca50c13bf55b821" -dependencies = [ - "cranelift-codegen-shared", - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca5b6ffaa87560bebe69a5446449da18090b126037920b0c1c6d5945f72faf6b" - -[[package]] -name = "cranelift-entity" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6b4a8bef04f82e4296782646f733c641d09497df2fabf791323fefaa44c64c" - -[[package]] -name = "cranelift-frontend" -version = "0.74.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b783b351f966fce33e3c03498cb116d16d97a8f9978164a60920bd0d3a99c" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" -dependencies = [ - "cfg-if 1.0.0", - "const_fn", - "crossbeam-utils", - "lazy_static", - "memoffset 0.5.5", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "const_fn", - "lazy_static", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "dynasm" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a59fbab09460c1569eeea9b5e4cf62f13f5198b1c2ba0e5196dd7fdd17cd42" -dependencies = [ - "bitflags", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dynasmrt" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bec3edae2841d37b1c3dc7f3fd403c9061f26e9ffeeee97a3ea909b1bb2ef1" -dependencies = [ - "byteorder", - "dynasm", - "memmap", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" - -[[package]] -name = "enumset" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3365a51d694a57eb4ee05fb3a7f11353708b1f3f1e9a3da4d003d7fcd1dd5135" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c0ab0a4d1e54dfbfef7aca606f4501af48235308449c7d985b0bbd2f8393ff" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" - -[[package]] -name = "gimli" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - -[[package]] -name = "hermit-abi" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "inkwell" -version = "0.1.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fe0be1e47c0c0f3da4397693e08f5d78329ae095c25d529e12ade78420fb41" -dependencies = [ - "either", - "inkwell_internals", - "libc", - "llvm-sys", - "once_cell", - "parking_lot", - "regex", -] - -[[package]] -name = "inkwell_internals" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e1f71330ccec54ee62533ae88574c4169b67fb4b95cbb1196a1322582abd11" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "instant" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "itertools" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -dependencies = [ - "either", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "leb128" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" - -[[package]] -name = "libc" -version = "0.2.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" - -[[package]] -name = "libloading" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" -dependencies = [ - "cfg-if 1.0.0", - "winapi", -] - -[[package]] -name = "llvm-sys" -version = "110.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ede189444b8c78907e5d36da5dabcf153170fcff9c1dba48afc4b33c7e19f0" -dependencies = [ - "cc", - "lazy_static", - "libc", - "regex", - "semver 0.11.0", -] - -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "loupe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79b0cc3aa7552a59274f642a0a6e7419b7f5438aba06a0a82825918ba69f0e6" -dependencies = [ - "indexmap", - "loupe-derive", - "rustversion", -] - -[[package]] -name = "loupe-derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a545b22ceeec36de91c46206afd384c17946bd62b95b76e927a2adb77fbdcc0" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "memmap2" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73be3b7d04a0123e933fea1d50d126cc7196bbc0362c0ce426694f777194eee" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" -dependencies = [ - "adler", -] - -[[package]] -name = "more-asserts" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - -[[package]] -name = "object" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" -dependencies = [ - "crc32fast", - "indexmap", -] - -[[package]] -name = "once_cell" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" - -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" - -[[package]] -name = "proc-macro-error" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "syn-mid", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "ptr_meta" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6de4703776ff261fe3cbf05c8781f129b284e57ee35a785fe6c92b1dcf93a612" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53005b9863728f508d3f23ae37e03d60986a01b65f7ae8397dcebaa1d5e54e10" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rayon" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "regalloc" -version = "0.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" -dependencies = [ - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "rkyv" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c6286f153ea0ca2abf231251fc6758cd5aef042d9e189b3a182abf2399c207" -dependencies = [ - "memoffset 0.6.1", - "ptr_meta", - "rkyv_derive", - "seahash", -] - -[[package]] -name = "rkyv_derive" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3fccbf52ee0b76a29417794226e225798dd6bd32e40debd9e284cecc20dd76" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustversion" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.1", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "semver-parser" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ef146c2ad5e5f4b037cd6ce2ebb775401729b19a82040c1beac9d36c7d1428" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - -[[package]] -name = "subtle" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" - -[[package]] -name = "syn" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "syn-mid" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "target-lexicon" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834" - -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "tracing" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" -dependencies = [ - "cfg-if 0.1.10", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasmer" -version = "1.0.2" -dependencies = [ - "cfg-if 1.0.0", - "indexmap", - "loupe", - "more-asserts", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-llvm", - "wasmer-compiler-singlepass", - "wasmer-derive", - "wasmer-engine", - "wasmer-engine-universal", - "wasmer-engine-dylib", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-cache" -version = "1.0.2" -dependencies = [ - "blake3", - "hex", - "thiserror", - "wasmer", -] - -[[package]] -name = "wasmer-compiler" -version = "1.0.2" -dependencies = [ - "enumset", - "loupe", - "rkyv", - "serde", - "serde_bytes", - "smallvec", - "target-lexicon", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "1.0.2" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "gimli 0.24.0", - "loupe", - "more-asserts", - "rayon", - "smallvec", - "tracing", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-compiler-llvm" -version = "1.0.2" -dependencies = [ - "byteorder", - "cc", - "inkwell", - "itertools", - "lazy_static", - "libc", - "loupe", - "object 0.24.0", - "rayon", - "regex", - "rustc_version", - "semver 0.11.0", - "smallvec", - "target-lexicon", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-compiler-singlepass" -version = "1.0.2" -dependencies = [ - "byteorder", - "dynasm", - "dynasmrt", - "lazy_static", - "loupe", - "more-asserts", - "rayon", - "smallvec", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-derive" -version = "1.0.2" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasmer-engine" -version = "1.0.2" -dependencies = [ - "backtrace", - "lazy_static", - "loupe", - "memmap2", - "more-asserts", - "rustc-demangle", - "serde", - "serde_bytes", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-engine-native" -version = "1.0.2" -dependencies = [ - "cfg-if 1.0.0", - "leb128", - "libloading", - "loupe", - "rkyv", - "serde", - "tempfile", - "tracing", - "wasmer-compiler", - "wasmer-engine", - "wasmer-object", - "wasmer-types", - "wasmer-vm", - "which", -] - -[[package]] -name = "wasmer-engine-dylib" -version = "1.0.2" -dependencies = [ - "cfg-if 1.0.0", - "leb128", - "loupe", - "region", - "rkyv", - "wasmer-compiler", - "wasmer-engine", - "wasmer-types", - "wasmer-vm", - "winapi", -] - -[[package]] -name = "wasmer-object" -version = "1.0.2" -dependencies = [ - "object 0.24.0", - "thiserror", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-runtime" -version = "0.18.0" -dependencies = [ - "wasmer-runtime-core", -] - -[[package]] -name = "wasmer-runtime-core" -version = "0.18.0" -dependencies = [ - "blake3", - "lazy_static", - "wasmer", - "wasmer-cache", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-llvm", - "wasmer-compiler-singlepass", - "wasmer-engine", - "wasmer-engine-universal", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-types" -version = "1.0.2" -dependencies = [ - "indexmap", - "loupe", - "rkyv", - "serde", - "thiserror", -] - -[[package]] -name = "wasmer-vm" -version = "1.0.2" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "indexmap", - "libc", - "loupe", - "memoffset 0.6.1", - "more-asserts", - "region", - "rkyv", - "serde", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmparser" -version = "0.78.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c7a8b20306d43c09c2c34e0ef68bf2959a11b01a5cae35e4c5dc1e7145547b6" - -[[package]] -name = "wast" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1844f66a2bc8526d71690104c0e78a8e59ffa1597b7245769d174ebb91deb5" -dependencies = [ - "leb128", -] - -[[package]] -name = "wat" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce85d72b74242c340e9e3492cfb602652d7bb324c3172dd441b5577e39a2e18c" -dependencies = [ - "wast", -] - -[[package]] -name = "which" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" -dependencies = [ - "libc", - "thiserror", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/lib/deprecated/runtime/Cargo.toml b/lib/deprecated/runtime/Cargo.toml deleted file mode 100644 index 0c60003b661..00000000000 --- a/lib/deprecated/runtime/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "wasmer-runtime" -version = "0.18.0" -description = "Wasmer runtime library (deprecated in favor of wasmer crate)" -categories = ["wasm", "api-bindings"] -keywords = ["wasm", "webassembly", "runtime"] -authors = ["Wasmer Engineering Team "] -repository = "https://github.com/wasmerio/wasmer" -license = "MIT" -readme = "README.md" -edition = "2018" - -[badges] -maintenance = { status = "deprecated" } - -[dependencies] -wasmer-runtime-core = { path = "../runtime-core/", version = "0.18.0" } - -[features] -default = ["cranelift", "wasmer-runtime-core/default"] -cranelift = ["wasmer-runtime-core/cranelift"] -llvm = ["wasmer-runtime-core/llvm"] -singlepass = ["wasmer-runtime-core/singlepass"] -default-backend-cranelift = ["cranelift", "wasmer-runtime-core/default-backend-cranelift"] -default-backend-llvm = ["llvm", "wasmer-runtime-core/default-backend-llvm"] -default-backend-singlepass = ["singlepass", "wasmer-runtime-core/default-backend-singlepass"] diff --git a/lib/deprecated/runtime/README.md b/lib/deprecated/runtime/README.md deleted file mode 100644 index 46052577fc5..00000000000 --- a/lib/deprecated/runtime/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# `wasmer-runtime` [DEPRECATED] [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/master/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-runtime.svg)](https://crates.io/crates/wasmer-runtime) - -## Deprecation notice: please read - -Thanks to users feedback, collected experience and various use cases, -Wasmer has decided to entirely improve its API to offer the best user -experience and the best features to as many users as possible. - -The new version of Wasmer (`1.0.0`) includes many improvements -in terms of performance or the memory consumption, in addition to a ton -of new features and much better flexibility! -You can check revamped new API in the [`wasmer`] crate. - -In order to help our existing users to enjoy the performance boost and -memory improvements without updating their program that much, we have -created a new version of the `wasmer-runtime` crate, which is now -*an adaptation* of the new API but with the old API syntax, as much as -possible. Indeed, it was not always possible to provide the exact same -API, but changes are subtle. - -We have carefully documented most of the differences in [the -`runtime-core/CHANGES.md` document][changes]. - -It is important to understand the public of this port. We do not -recommend to advanced users of Wasmer to use this port. Advanced API, -like `ModuleInfo` or the `vm` module (incl. `vm::Ctx`) have not been -fully ported because it was very internals to Wasmer. For advanced -users, we highly recommend to migrate to the new version of Wasmer, -which is awesome by the way (completely neutral opinion). The public -for this port is beginners or regular users that do not necesarily -have time to update their code immediately but that want to enjoy a -performance boost and memory improvements. - -[`wasmer`]: https://crates.io/crates/wasmer/ -[changes]: ../runtime-core/CHANGES.md - -## Introduction - -Wasmer is a standalone JIT WebAssembly runtime, aiming to be fully -compatible with Emscripten, Rust and Go. [Learn -more](https://github.com/wasmerio/wasmer). - -This crate represents the high-level runtime API, making embedding -WebAssembly in your application easy, efficient, and safe. - -### How to use Wasmer Runtime - -The easiest way is to use the [`instantiate`] function to create an -[`Instance`]. Then you can use [`call`] or [`func`] and then -[`call`][func.call] to call an exported function safely. - -[`instantiate`]: https://docs.rs/wasmer-runtime/*/wasmer_runtime/fn.instantiate.html -[`Instance`]: https://docs.rs/wasmer-runtime/*/wasmer_runtime/struct.Instance.html -[`call`]: https://docs.rs/wasmer-runtime/*/wasmer_runtime/struct.Instance.html#method.call -[`func`]: https://docs.rs/wasmer-runtime/*/wasmer_runtime/struct.Instance.html#method.func -[func.call]: https://docs.rs/wasmer-runtime/*/wasmer_runtime/struct.Function.html#method.call - -### Example - -Given this WebAssembly: - -```wat -(module - (type $t0 (func (param i32) (result i32))) - (func $add_one (export "add_one") (type $t0) (param $p0 i32) (result i32) - get_local $p0 - i32.const 1 - i32.add)) -``` - -compiled into Wasm bytecode, we can call the exported `add_one` function: - -```rust -use wasmer_runtime::{imports, instantiate, DynFunc, Value}; - -static WASM: &'static [u8] = &[ - // The module above compiled to bytecode goes here. - 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, - 0x01, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0b, 0x01, 0x07, - 0x61, 0x64, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x0a, 0x09, 0x01, - 0x07, 0x00, 0x20, 0x00, 0x41, 0x01, 0x6a, 0x0b, 0x00, 0x1a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x01, 0x0a, 0x01, 0x00, 0x07, 0x61, 0x64, 0x64, 0x5f, - 0x6f, 0x6e, 0x65, 0x02, 0x07, 0x01, 0x00, 0x01, 0x00, 0x02, 0x70, 0x30, -]; - -fn main() -> Result<(), Box> { - // We're not importing anything, so make an empty import object. - let import_object = imports! {}; - - // Compile _and_ instantiate the Wasm module. - let instance = instantiate(WASM, &import_object)?; - - // Call the `add_one` exported function. - let values = instance - .exports - .get::("add_one")? - .call(&[Value::I32(42)])?; - - assert_eq!(values[0], Value::I32(43)); - - Ok(()) -} -``` - -### Additional Notes - -The `wasmer-runtime` crate is built to support multiple compiler -backends: - -* [`wasmer-compiler-singlepass`], -* [`wasmer-compiler-cranelift`], -* [`wasmer-compiler-llvm`]. - -You can specify the compiler you wish to use with the [`compile_with`] function: - -```rust -use wasmer_runtime::{compile_with, Backend}; - -let module = compile_with(wasm_bytes, Backend::LLVM)?; -``` - -[`compile_with`]: https://docs.rs/wasmer-runtime/*/wasmer_runtime/fn.compile_with.html -[`wasmer-compiler-singlepass`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-singlepass -[`wasmer-compiler-cranelift`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-cranelift -[`wasmer-compiler-llvm`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-llvm diff --git a/lib/deprecated/runtime/examples/call.rs b/lib/deprecated/runtime/examples/call.rs deleted file mode 100644 index b56914dd90a..00000000000 --- a/lib/deprecated/runtime/examples/call.rs +++ /dev/null @@ -1,63 +0,0 @@ -use std::{error, fmt}; -use wasmer_runtime::{compile, error::RuntimeError, imports, wat2wasm, Ctx, Func}; - -static WAT: &'static str = r#" - (module - (type (;0;) (func (result i32))) - (import "env" "do_panic" (func $do_panic (type 0))) - (func $dbz (result i32) - call $do_panic - drop - i32.const 42 - i32.const 0 - i32.div_u - ) - (export "dbz" (func $dbz)) - ) -"#; - -fn get_wasm() -> Vec { - wat2wasm(WAT.as_bytes()).unwrap().to_vec() -} - -#[derive(Debug)] -struct ExitCode { - code: i32, -} - -impl error::Error for ExitCode {} - -impl fmt::Display for ExitCode { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}", self) - } -} - -fn do_panic(_ctx: &mut Ctx) -> Result { - Err(RuntimeError::new(ExitCode { code: 42 }.to_string())) -} - -fn main() -> Result<(), Box> { - let wasm = get_wasm(); - let module = compile(&wasm)?; - - println!("instantiating"); - - let instance = module.instantiate(&imports! { - "env" => { - "do_panic" => Func::new(do_panic), - }, - })?; - - let foo: Func<(), i32> = instance.exports.get("dbz")?; - let result = foo.call(); - - println!("result: {:?}", result.unwrap_err().message()); - - Ok(()) -} - -#[test] -fn test_call() -> Result<(), Box> { - main() -} diff --git a/lib/deprecated/runtime/examples/readme.rs b/lib/deprecated/runtime/examples/readme.rs deleted file mode 100644 index 5626d8c1bf7..00000000000 --- a/lib/deprecated/runtime/examples/readme.rs +++ /dev/null @@ -1,29 +0,0 @@ -use wasmer_runtime::{imports, instantiate, DynFunc, Value}; - -static WASM: &'static [u8] = &[ - 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, 0x7f, - 0x03, 0x02, 0x01, 0x00, 0x07, 0x0b, 0x01, 0x07, 0x61, 0x64, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x00, - 0x00, 0x0a, 0x09, 0x01, 0x07, 0x00, 0x20, 0x00, 0x41, 0x01, 0x6a, 0x0b, 0x00, 0x1a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x01, 0x0a, 0x01, 0x00, 0x07, 0x61, 0x64, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x02, - 0x07, 0x01, 0x00, 0x01, 0x00, 0x02, 0x70, 0x30, -]; - -fn main() -> Result<(), Box> { - let import_object = imports! {}; - - let instance = instantiate(WASM, &import_object)?; - - let values = instance - .exports - .get::("add_one")? - .call(&[Value::I32(42)])?; - - assert_eq!(values[0], Value::I32(43)); - - Ok(()) -} - -#[test] -fn test_readme() -> Result<(), Box> { - main() -} diff --git a/lib/deprecated/runtime/src/lib.rs b/lib/deprecated/runtime/src/lib.rs deleted file mode 100644 index 18216729392..00000000000 --- a/lib/deprecated/runtime/src/lib.rs +++ /dev/null @@ -1,159 +0,0 @@ -//! Wasmer-runtime is a library that makes embedding WebAssembly -//! in your application easy, efficient, and safe. -//! -//! # How to use Wasmer-Runtime -//! -//! The easiest way is to use the [`instantiate`] function to create an [`Instance`]. -//! Then you can use [`call`] or [`func`] and then [`call`][func.call] to call an exported function safely. -//! -//! [`instantiate`]: fn.instantiate.html -//! [`Instance`]: struct.Instance.html -//! [`call`]: struct.Instance.html#method.call -//! [`func`]: struct.Instance.html#method.func -//! [func.call]: struct.Function.html#method.call -//! -//! ## Example -//! -//! Given this WebAssembly: -//! -//! ```wat -//! (module -//! (type $t0 (func (param i32) (result i32))) -//! (func $add_one (export "add_one") (type $t0) (param $p0 i32) (result i32) -//! get_local $p0 -//! i32.const 1 -//! i32.add)) -//! ``` -//! -//! compiled into wasm bytecode, we can call the exported `add_one` function: -//! -//! ```rust -//! static WASM: &'static [u8] = &[ -//! 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, -//! 0x01, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0b, 0x01, 0x07, -//! 0x61, 0x64, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x0a, 0x09, 0x01, -//! 0x07, 0x00, 0x20, 0x00, 0x41, 0x01, 0x6a, 0x0b, 0x00, 0x1a, 0x04, 0x6e, -//! 0x61, 0x6d, 0x65, 0x01, 0x0a, 0x01, 0x00, 0x07, 0x61, 0x64, 0x64, 0x5f, -//! 0x6f, 0x6e, 0x65, 0x02, 0x07, 0x01, 0x00, 0x01, 0x00, 0x02, 0x70, 0x30, -//! ]; -//! -//! use wasmer_runtime::{ -//! instantiate, -//! Value, -//! imports, -//! Func, -//! }; -//! -//! fn main() -> Result<(), Box> { -//! let import_object = imports! {}; -//! let mut instance = instantiate(WASM, &import_object)?; -//! -//! let add_one: Func = instance.exports.get("add_one")?; -//! -//! let value = add_one.call(42)?; -//! assert_eq!(value, 43); -//! -//! Ok(()) -//! } -//! ``` - -use std::{error::Error, fmt}; - -pub use wasmer_runtime_core::{ - backend::Backend, - compile, compile_with, - export::{Export, RuntimeExport}, - func, - global::Global, - import::{ImportObject, LikeNamespace}, - imports, - instance::{DynFunc, Instance}, - load_cache_with, - memory::ptr::{Array, Item, WasmPtr}, - memory::Memory, - module::Module, - table::Table, - typed_func::{DynamicFunc, Func}, - types::Value, - validate, - vm::Ctx, - wat2wasm, -}; - -pub mod memory { - //! The memory module contains the implementation data structures - //! and helper functions used to manipulate and access wasm - //! memory. - pub use wasmer_runtime_core::memory::{Atomically, Memory, MemoryView}; -} - -pub mod wasm { - //! Various types exposed by the Wasmer Runtime. - pub use wasmer_runtime_core::{ - global::Global, - table::Table, - types::{FuncSig, GlobalDescriptor, MemoryDescriptor, TableDescriptor, Type, Value}, - }; -} - -pub mod error { - //! The error module contains the data structures and helper - //! functions used to implement errors that are produced and - //! returned from the wasmer runtime. - pub use wasmer_runtime_core::error::*; -} - -pub mod units { - //! Various unit types. - pub use wasmer_runtime_core::units::{Bytes, Pages}; -} - -pub mod types { - //! Types used in the Wasm runtime and conversion functions. - pub use wasmer_runtime_core::types::*; -} - -pub mod cache { - //! The cache module provides the common data structures used by - //! compiler backends to allow serializing compiled wasm code to a - //! binary format. The binary format can be persisted, and loaded - //! to allow skipping compilation and fast startup. - pub use wasmer_runtime_core::cache::*; -} - -#[derive(Debug)] -pub enum InstantiateError { - CompileError(Box), - InstantiationError(wasmer_runtime_core::error::InstantiationError), -} - -impl Error for InstantiateError { - fn source(&self) -> Option<&(dyn Error + 'static)> { - match self { - Self::CompileError(e) => e.source(), - Self::InstantiationError(e) => e.source(), - } - } -} - -impl fmt::Display for InstantiateError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::CompileError(e) => e.fmt(f), - Self::InstantiationError(e) => e.fmt(f), - } - } -} - -pub fn instantiate( - wasm: &[u8], - import_object: &ImportObject, -) -> Result { - let module = compile(wasm).map_err(InstantiateError::CompileError)?; - - module - .instantiate(import_object) - .map_err(InstantiateError::InstantiationError) -} - -pub const VERSION: &str = env!("CARGO_PKG_VERSION");