* Use an mmap-friendly serialization format This commit reimplements the main serialization format for Wasmtime's precompiled artifacts. Previously they were generally a binary blob of `bincode`-encoded metadata prefixed with some versioning information. The downside of this format, though, is that loading a precompiled artifact required pushing all information through `bincode`. This is inefficient when some data, such as trap/address tables, are rarely accessed. The new format added in this commit is one which is designed to be `mmap`-friendly. This means that the relevant parts of the precompiled artifact are already page-aligned for updating permissions of pieces here and there. Additionally the artifact is optimized so that if data is rarely read then we can delay reading it until necessary. The new artifact format for serialized modules is an ELF file. This is not a public API guarantee, so it cannot be relied upon. In the meantime though this is quite useful for exploring precompiled modules with standard tooling like `objdump`. The ELF file is already constructed as part of module compilation, and this is the main contents of the serialized artifact. THere is some extra information, though, not encoded in each module's individual ELF file such as type information. This information continues to be `bincode`-encoded, but it's intended to be much smaller and much faster to deserialize. This extra information is appended to the end of the ELF file. This means that the original ELF file is still a valid ELF file, we just get to have extra bits at the end. More information on the new format can be found in the module docs of the serialization module of Wasmtime. Another refatoring implemented as part of this commit is to deserialize and store object files directly in `mmap`-backed storage. This avoids the need to copy bytes after the artifact is loaded into memory for each compiled module, and in a future commit it opens up the door to avoiding copying the text section into a `CodeMemory`. For now, though, the main change is that copies are not necessary when loading from a precompiled compilation artifact once the artifact is itself in mmap-based memory. To assist with managing `mmap`-based memory a new `MmapVec` type was added to `wasmtime_jit` which acts as a form of `Vec<T>` backed by a `wasmtime_runtime::Mmap`. This type notably supports `drain(..N)` to slice the buffer into disjoint regions that are all separately owned, such as having a separately owned window into one artifact for all object files contained within. Finally this commit implements a small refactoring in `wasmtime-cache` to use the standard artifact format for cache entries rather than a bincode-encoded version. This required some more hooks for serializing/deserializing but otherwise the crate still performs as before. * Review comments
123 lines
3.4 KiB
TOML
123 lines
3.4 KiB
TOML
[package]
|
|
name = "wasmtime-cli"
|
|
version = "0.29.0"
|
|
authors = ["The Wasmtime Project Developers"]
|
|
description = "Command-line interface for Wasmtime"
|
|
license = "Apache-2.0 WITH LLVM-exception"
|
|
documentation = "https://bytecodealliance.github.io/wasmtime/cli.html"
|
|
categories = ["wasm"]
|
|
keywords = ["webassembly", "wasm"]
|
|
repository = "https://github.com/bytecodealliance/wasmtime"
|
|
readme = "README.md"
|
|
edition = "2018"
|
|
default-run = "wasmtime"
|
|
|
|
[lib]
|
|
doctest = false
|
|
|
|
[[bin]]
|
|
name = "wasmtime"
|
|
path = "src/bin/wasmtime.rs"
|
|
doc = false
|
|
|
|
[dependencies]
|
|
wasmtime = { path = "crates/wasmtime", version = "0.29.0", default-features = false, features = ['cache', 'cranelift'] }
|
|
wasmtime-cache = { path = "crates/cache", version = "0.29.0" }
|
|
wasmtime-cranelift = { path = "crates/cranelift", version = "0.29.0" }
|
|
wasmtime-environ = { path = "crates/environ", version = "0.29.0" }
|
|
wasmtime-jit = { path = "crates/jit", version = "0.29.0" }
|
|
wasmtime-wast = { path = "crates/wast", version = "0.29.0" }
|
|
wasmtime-wasi = { path = "crates/wasi", version = "0.29.0" }
|
|
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.29.0", optional = true }
|
|
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.29.0", optional = true }
|
|
structopt = { version = "0.3.5", features = ["color", "suggestions"] }
|
|
object = { version = "0.26.0", default-features = false, features = ["write"] }
|
|
anyhow = "1.0.19"
|
|
target-lexicon = { version = "0.12.0", default-features = false }
|
|
pretty_env_logger = "0.4.0"
|
|
file-per-thread-logger = "0.1.1"
|
|
wat = "1.0.39"
|
|
libc = "0.2.60"
|
|
log = "0.4.8"
|
|
rayon = "1.5.0"
|
|
humantime = "2.0.0"
|
|
wasmparser = "0.80.0"
|
|
lazy_static = "1.4.0"
|
|
|
|
[dev-dependencies]
|
|
env_logger = "0.8.1"
|
|
filecheck = "0.5.0"
|
|
more-asserts = "0.2.1"
|
|
tempfile = "3.1.0"
|
|
test-programs = { path = "crates/test-programs" }
|
|
wasmtime-fuzzing = { path = "crates/fuzzing" }
|
|
wasmtime-runtime = { path = "crates/runtime" }
|
|
tokio = { version = "1.8.0", features = ["rt", "time", "macros", "rt-multi-thread"] }
|
|
tracing-subscriber = "0.2.16"
|
|
wast = "37.0.0"
|
|
criterion = "0.3.4"
|
|
num_cpus = "1.13.0"
|
|
winapi = { version = "0.3.9", features = ['memoryapi'] }
|
|
memchr = "2.4"
|
|
|
|
[build-dependencies]
|
|
anyhow = "1.0.19"
|
|
|
|
[profile.release.build-override]
|
|
opt-level = 0
|
|
|
|
[workspace]
|
|
resolver = '2'
|
|
members = [
|
|
"cranelift",
|
|
"crates/bench-api",
|
|
"crates/c-api",
|
|
"crates/lightbeam/wasmtime",
|
|
"crates/misc/run-examples",
|
|
"examples/fib-debug/wasm",
|
|
"examples/wasi/wasm",
|
|
"examples/tokio/wasm",
|
|
"fuzz",
|
|
]
|
|
exclude = ['crates/wasi-common/WASI/tools/witx-cli']
|
|
|
|
[features]
|
|
default = ["jitdump", "wasmtime/wat", "wasmtime/parallel-compilation", "wasi-nn"]
|
|
lightbeam = ["wasmtime/lightbeam"]
|
|
jitdump = ["wasmtime/jitdump"]
|
|
vtune = ["wasmtime/vtune"]
|
|
wasi-crypto = ["wasmtime-wasi-crypto"]
|
|
wasi-nn = ["wasmtime-wasi-nn"]
|
|
uffd = ["wasmtime/uffd"]
|
|
all-arch = ["wasmtime/all-arch"]
|
|
posix-signals-on-macos = ["wasmtime/posix-signals-on-macos"]
|
|
|
|
# Stub feature that does nothing, for Cargo-features compatibility: the new
|
|
# backend is the default now.
|
|
experimental_x64 = []
|
|
|
|
# Use the old x86 backend.
|
|
old-x86-backend = ["wasmtime/old-x86-backend"]
|
|
|
|
[badges]
|
|
maintenance = { status = "actively-developed" }
|
|
|
|
[[test]]
|
|
name = "host_segfault"
|
|
harness = false
|
|
|
|
[[example]]
|
|
name = "tokio"
|
|
required-features = ["wasmtime-wasi/tokio"]
|
|
|
|
[profile.dev.package.backtrace]
|
|
debug = false # FIXME(#1813)
|
|
|
|
[[bench]]
|
|
name = "instantiation"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "thread_eager_init"
|
|
harness = false
|