Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start a high-level architecture document for Wasmtime #3019

Merged
merged 4 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/wasmtime-cranelift/"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
4 changes: 0 additions & 4 deletions crates/cranelift/README.md

This file was deleted.

1 change: 0 additions & 1 deletion crates/debug/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/wasmtime-debug/"
categories = ["wasm"]
keywords = ["webassembly", "wasm", "debuginfo"]
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
4 changes: 0 additions & 4 deletions crates/debug/README.md

This file was deleted.

1 change: 0 additions & 1 deletion crates/environ/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/wasmtime-environ/"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
6 changes: 0 additions & 6 deletions crates/environ/README.md

This file was deleted.

1 change: 0 additions & 1 deletion crates/jit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
10 changes: 0 additions & 10 deletions crates/jit/README.md

This file was deleted.

1 change: 0 additions & 1 deletion crates/obj/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
5 changes: 0 additions & 5 deletions crates/obj/README.md

This file was deleted.

1 change: 0 additions & 1 deletion crates/profiling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
2 changes: 0 additions & 2 deletions crates/profiling/README.md

This file was deleted.

1 change: 0 additions & 1 deletion crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
14 changes: 0 additions & 14 deletions crates/runtime/README.md

This file was deleted.

29 changes: 25 additions & 4 deletions crates/runtime/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,39 @@ pub trait ResourceLimiter {
}
}

/// A WebAssembly instance.
/// A type that roughly corresponds to a WebAssembly instance, but is also used
/// for host-defined objects.
///
/// This is repr(C) to ensure that the vmctx field is last.
#[repr(C)]
/// This structure is is never allocated directly but is instead managed through
/// an `InstanceHandle`. This structure ends with a `VMContext` which has a
/// dynamic size corresponding to the `module` configured within. Memory
/// management of this structure is always externalized.
///
/// Instances here can correspond to actual instantiated modules, but it's also
/// used ubiquitously for host-defined objects. For example creating a
/// host-defined memory will have a `module` that looks like it exports a single
/// memory (and similar for other constructs).
///
/// This `Instance` type is used as a ubiquitous representation for WebAssembly
/// values, whether or not they were created on the host or through a module.
#[repr(C)] // ensure that the vmctx field is last.
pub(crate) struct Instance {
/// The `Module` this `Instance` was instantiated from.
module: Arc<Module>,

/// Offsets in the `vmctx` region.
/// Offsets in the `vmctx` region, precomputed from the `module` above.
offsets: VMOffsets,

/// WebAssembly linear memory data.
///
/// This is where all runtime information about defined linear memories in
/// this module lives.
memories: PrimaryMap<DefinedMemoryIndex, Memory>,

/// WebAssembly table data.
///
/// Like memories, this is only for defined tables in the module and
/// contains all of their runtime state.
tables: PrimaryMap<DefinedTableIndex, Table>,

/// Stores the dropped passive element segments in this instantiation by index.
Expand All @@ -125,6 +143,9 @@ pub(crate) struct Instance {
dropped_data: EntitySet<DataIndex>,

/// Hosts can store arbitrary per-instance information here.
///
/// Most of the time from Wasmtime this is `Box::new(())`, a noop
/// allocation, but some host-defined objects will store their state here.
host_state: Box<dyn Any + Send + Sync>,

/// Additional context used by compiled wasm code. This field is last, and
Expand Down
1 change: 0 additions & 1 deletion crates/wast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"

[dependencies]
Expand Down
5 changes: 0 additions & 5 deletions crates/wast/README.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
- [Disclosure Policy](./security-disclosure.md)
- [Sandboxing](./security-sandboxing.md)
- [Contributing](contributing.md)
- [Architecture](./contributing-architecture.md)
- [Building](./contributing-building.md)
- [Testing](./contributing-testing.md)
- [Fuzzing](./contributing-fuzzing.md)
Expand Down
Loading