1[package] 2name = "wasmtime" 3version.workspace = true 4authors.workspace = true 5description = "High-level API to expose the Wasmtime runtime" 6documentation = "https://docs.rs/wasmtime" 7license = "Apache-2.0 WITH LLVM-exception" 8repository = "https://github.com/bytecodealliance/wasmtime" 9readme = "README.md" 10edition.workspace = true 11rust-version.workspace = true 12 13[lints] 14workspace = true 15 16[package.metadata.docs.rs] 17all-features = true 18 19[dependencies] 20wasmtime-environ = { workspace = true } 21wasmtime-jit-debug = { workspace = true, optional = true } 22wasmtime-jit-icache-coherence = { workspace = true, optional = true } 23wasmtime-cache = { workspace = true, optional = true } 24wasmtime-fiber = { workspace = true, optional = true } 25wasmtime-cranelift = { workspace = true, optional = true, features = ['pulley'] } 26wasmtime-unwinder = { workspace = true, optional = true } 27wasmtime-winch = { workspace = true, optional = true } 28wasmtime-component-macro = { workspace = true, optional = true } 29wasmtime-component-util = { workspace = true, optional = true } 30wasmtime-versioned-export-macros = { workspace = true } 31wasmtime-wmemcheck = { workspace = true, optional = true } 32wasmtime-core = { workspace = true, features = ['serde'] } 33pulley-interpreter = { workspace = true } 34target-lexicon = { workspace = true } 35wasmparser = { workspace = true } 36wasm-encoder = { workspace = true, optional = true } 37wasm-wave = { workspace = true, optional = true } 38wasm-compose = { workspace = true, optional = true } 39tempfile = { workspace = true, optional = true } 40libc = { workspace = true } 41cfg-if = { workspace = true } 42log = { workspace = true } 43wat = { workspace = true, optional = true } 44serde = { workspace = true } 45serde_derive = { workspace = true } 46serde_json = { workspace = true, optional = true } 47postcard = { workspace = true } 48once_cell = { version = "1.12.0", optional = true } 49rayon = { workspace = true, optional = true } 50object = { workspace = true, features = ['unaligned'] } 51async-trait = { workspace = true, optional = true } 52encoding_rs = { version = "0.8.31", optional = true } 53bumpalo = { workspace = true } 54fxprof-processed-profile = { version = "0.8.1", optional = true } 55gimli = { workspace = true, optional = true } 56addr2line = { workspace = true, optional = true } 57semver = { workspace = true, optional = true } 58smallvec = { workspace = true, optional = true } 59bitflags = { workspace = true } 60futures = { workspace = true, features = ["alloc"], optional = true } 61bytes = { workspace = true, optional = true } 62 63[target.'cfg(target_os = "windows")'.dependencies.windows-sys] 64workspace = true 65optional = true 66features = [ 67 "Win32_Foundation", 68 "Win32_System_Kernel", 69 "Win32_System_Memory", 70 "Win32_System_Diagnostics_Debug", 71 "Win32_System_SystemInformation", 72 "Win32_Storage_FileSystem", 73 "Win32_Security", 74] 75 76# Allow-list the platforms that `ittapi` builds on since it's got C code that 77# doesn't compile by default on all platforms just yet. Also note that this is 78# only enabled for `x86_64` targets as well. 79[target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.dependencies] 80ittapi = { workspace = true, optional = true } 81[target.'cfg(all(target_arch = "x86_64", target_os = "macos"))'.dependencies] 82ittapi = { workspace = true, optional = true } 83[target.'cfg(all(target_arch = "x86_64", target_os = "windows"))'.dependencies] 84ittapi = { workspace = true, optional = true } 85 86[target.'cfg(target_os = "linux")'.dependencies] 87memfd = { workspace = true, optional = true } 88 89[target.'cfg(target_vendor = "apple")'.dependencies] 90mach2 = { workspace = true, optional = true } 91 92[target.'cfg(unix)'.dependencies] 93rustix = { workspace = true, optional = true, features = ["mm", "param"] } 94 95[dev-dependencies] 96env_logger = { workspace = true } 97proptest = { workspace = true } 98rand = { workspace = true } 99tempfile = { workspace = true } 100libtest-mimic = { workspace = true } 101cranelift-native = { workspace = true } 102wasmtime-test-util = { workspace = true } 103tokio = { workspace = true, features = ["macros", "sync", "rt-multi-thread"] } 104 105[build-dependencies] 106cc = { workspace = true, optional = true } 107wasmtime-versioned-export-macros = { workspace = true, optional = true } 108 109[[test]] 110name = "host_segfault" 111harness = false 112 113[[test]] 114name = "engine_across_forks" 115harness = false 116 117[[test]] 118name = "pooling_alloc_near_oom" 119harness = false 120 121# ============================================================================= 122# 123# Features for the Wasmtime crate. 124# 125# This section contains the compile-time features of the `wasmtime` crate. These 126# features can be used to add more functionality and APIs exposed from the 127# crate's API. Most of them are enabled by default. Disabling features can be 128# done to cut down on binary size by disabling features that are not required 129# for a particular embedding. 130[features] 131default = [ 132 'anyhow', 133 'async', 134 'backtrace', 135 'cache', 136 'gc', 137 'gc-drc', 138 'gc-null', 139 'wat', 140 'profiling', 141 'parallel-compilation', 142 'cranelift', 143 'pooling-allocator', 144 'demangle', 145 'addr2line', 146 'coredump', 147 'debug-builtins', 148 'runtime', 149 'component-model', 150 'component-model-async', 151 'threads', 152 'stack-switching', 153 'std', 154 'debug', 155 'compile-time-builtins', 156] 157 158# Enables conversion helpers between `anyhow::Error` and `wasmtime::Error`. 159anyhow = ["wasmtime-environ/anyhow"] 160 161# Enables backtrace capturing in `wasmtime::Error`. 162backtrace = ["std", "wasmtime-environ/backtrace"] 163 164# An on-by-default feature enabling runtime compilation of WebAssembly modules 165# with the Cranelift compiler. Cranelift is the default compilation backend of 166# Wasmtime. If disabled then WebAssembly modules can only be created from 167# precompiled WebAssembly modules. 168cranelift = ["dep:wasmtime-cranelift", "std", "wasmtime-unwinder/cranelift"] 169 170# Enables support for Winch, the WebAssembly baseline compiler. The Winch compiler 171# strategy in `Config` will be available. It is currently in active development 172# and shouldn't be used in production applications. 173winch = ["dep:wasmtime-winch", "std"] 174 175# Enables support for Pulley, the WebAssembly interpreter. When paired with the 176# `cranelift` feature, the compiler backends for the `pulley32` and `pulley64` 177# targets will be available. When paired with the `runtime` feature, the Pulley 178# interpreter will be built into the runtime and you can interpret WebAssembly 179# modules that have been compiled to Pulley bytecode. 180pulley = [ 181 # Note that this is intentionally empty. This feature is dynamically activated 182 # in `build.rs` as well when the host platform does not have Cranelift support 183 # for example. That means that dependencies for pulley need to be already 184 # activated anyway. 185] 186 187# Enables support for incremental compilation cache to be enabled in `Config`. 188incremental-cache = ["wasmtime-cranelift?/incremental-cache", "std"] 189 190# Enables support for profiling guest modules. 191profiling = [ 192 "dep:fxprof-processed-profile", 193 "dep:ittapi", 194 "dep:rustix", 195 "rustix/thread", 196 "dep:serde_json", 197 "std", 198 "wasmtime-jit-debug/perf_jitdump", 199] 200 201# Enables parallel compilation of WebAssembly code. 202parallel-compilation = ["dep:rayon", "std"] 203 204# Enables support for automatic cache configuration to be enabled in `Config`. 205cache = ["dep:wasmtime-cache", "std"] 206 207# Enables support for "async stores" as well as defining host functions as 208# `async fn` and calling functions asynchronously. 209async = [ 210 "dep:wasmtime-fiber", 211 "wasmtime-component-macro?/async", 212 "runtime", 213] 214 215# Enables support for the pooling instance allocation strategy 216pooling-allocator = [ 217 "runtime", 218 "std", # not ported to no_std yet 219] 220 221# Enables support for all architectures in Cranelift, allowing 222# cross-compilation using the `wasmtime` crate's API, notably the 223# `Engine::precompile_module` function. 224all-arch = ["wasmtime-cranelift?/all-arch", "wasmtime-winch?/all-arch", "pulley"] 225 226# Enables in-progress support for the component model. Note that this feature is 227# in-progress, buggy, and incomplete. This is primarily here for internal 228# testing purposes. 229component-model = [ 230 "wasmtime-environ/component-model", 231 "wasmtime-cranelift?/component-model", 232 "wasmtime-winch?/component-model", 233 "dep:wasmtime-component-macro", 234 "dep:wasmtime-component-util", 235 "dep:encoding_rs", 236 "dep:semver", 237] 238 239wmemcheck = [ 240 "dep:wasmtime-wmemcheck", 241 "wasmtime-cranelift?/wmemcheck", 242 "wasmtime-winch?/wmemcheck", 243 "wasmtime-environ/wmemcheck", 244 "std", 245] 246 247# Enables detailed internal compiler logging via WASMTIME_LOG 248trace-log = ["wasmtime-cranelift?/trace-log"] 249 250# Enables support for demangling WebAssembly function names at runtime in 251# errors such as backtraces. 252demangle = ["wasmtime-environ/demangle"] 253 254# Enable support for generating core dumps on traps. 255coredump = ["dep:wasm-encoder", "runtime", "std"] 256 257# Export some symbols from the final binary to assist in debugging 258# Cranelift-generated code with native debuggers like GDB and LLDB. 259debug-builtins = [ 260 "wasmtime-jit-debug/gdb_jit_int", 261] 262 263# Enable support for executing compiled Wasm modules. 264runtime = [ 265 "dep:cc", 266 "dep:smallvec", 267 "dep:mach2", 268 "dep:memfd", 269 "dep:wasmtime-versioned-export-macros", 270 "dep:windows-sys", 271 "pulley-interpreter/interp", 272 "dep:wasmtime-unwinder", 273 "dep:async-trait", 274] 275 276# Enable support for garbage collection-related things. 277# 278# This Cargo feature is required to compile or run Wasm that uses any of the 279# following Wasm proposals: 280# 281# * Reference types: https://github.com/WebAssembly/reference-types/ 282# * Typed function references: https://github.com/WebAssembly/function-references/ 283# * Garbage collection: https://github.com/WebAssembly/gc 284# 285# When a compiler Cargo feature (`cranelift` or `winch`) is enabled, this 286# feature gates the ability to compile Wasm that uses those proposals. 287# 288# When the `runtime` Cargo feature is enabled, this feature gates the ability to 289# load and run Wasm that uses those proposals. 290# 291# You can additionally configure which GC implementations are enabled via the 292# `gc-drc` and `gc-null` features. 293gc = [ 294 "wasmtime-environ/gc", 295 "wasmtime-cranelift?/gc", 296 "wasmtime-winch?/gc", 297] 298 299# Enable the deferred reference counting garbage collector. 300gc-drc = [ 301 "gc", 302 "wasmtime-environ/gc-drc", 303 "wasmtime-cranelift?/gc-drc", 304 "wasmtime-winch?/gc-drc", 305] 306 307# Enable the null garbage collector. 308gc-null = [ 309 "gc", 310 "wasmtime-environ/gc-null", 311 "wasmtime-cranelift?/gc-null", 312 "wasmtime-winch?/gc-null", 313] 314 315# Enable runtime support for the WebAssembly threads proposal. 316threads = [ 317 "wasmtime-cranelift?/threads", 318 "wasmtime-winch?/threads", 319 "std", 320] 321 322stack-switching = [ 323 "runtime", 324 "std", 325 "wasmtime-environ/stack-switching", 326 "wasmtime-cranelift?/stack-switching", 327 "wasmtime-winch?/stack-switching", 328] 329 330# Controls whether backtraces will attempt to parse DWARF information in 331# WebAssembly modules and components to provide filenames and line numbers in 332# stack traces. 333addr2line = ["dep:addr2line", "dep:gimli", "std"] 334 335# Enables support for the Rust standard library, enabling APIs that require 336# types and traits from Rust's `std` such as `Path` and `Error`. 337# 338# Many features of the Wasmtime crate implicitly require this `std` feature. 339# This will be automatically enabled if necessary. 340std = [ 341 'postcard/use-std', 342 'wasmtime-environ/std', 343 'wasmtime-core/std', 344 'object/std', 345 'once_cell', 346 'wasmtime-fiber?/std', 347 'pulley-interpreter/std', 348 'wasmtime-core/std', 349 'addr2line?/std', 350 "dep:rustix", 351 "wasmtime-jit-icache-coherence", 352 "wasmtime-jit-debug?/std", 353] 354 355# Enables support for the `Store::call_hook` API which enables injecting custom 356# logic around all entries/exits from WebAssembly. This has a slight performance 357# cost for all host functions. 358call-hook = [] 359 360# Enables support for "memory protection keys" which can be used in conjunction 361# with the pooling allocator on x64 to compact linear memory allocations. 362memory-protection-keys = ["pooling-allocator"] 363 364# Enables a re-export of wasmparser, so that an embedder of Wasmtime can use 365# exactly the version of the parser library that Wasmtime does. Sometimes this 366# is necessary, e.g. to guarantee that there will not be any mismatches in 367# which modules are accepted due to Wasm feature configuration or support 368# levels. 369# 370# Note that when this feature is enabled, the version of wasmparser that is 371# re-exported is *not subject to semver*: we reserve the right to make patch 372# releases of Wasmtime that bump the version of wasmparser used, and hence the 373# version re-exported, in semver-incompatible ways. This is the tradeoff that 374# the embedder needs to opt into: in order to stay exactly in sync with an 375# internal detail of Wasmtime, the cost is visibility into potential internal 376# version changes. This is why the re-export is guarded by a feature flag which 377# is off by default. 378reexport-wasmparser = [] 379 380# Enables instances of the traits defined in the wasm-wave crate, which 381# provides a human-readable text format for component values. 382wave = ["dep:wasm-wave", "component-model", "std"] 383 384# For platforms that Wasmtime does not have support for Wasmtime will disable 385# the use of virtual memory by default, for example allocating linear memories 386# with `malloc` instead. This feature can be used, for these platforms, to 387# instead use a C API defined in `wasmtime-platform.h` instead. 388# 389# For some more information see 390# https://docs.wasmtime.dev/stability-platform-support.html#support-for-no_std 391# 392# This feature is not necessary for supported platforms like Unix and Windows as 393# virtual memory is always enabled there. 394custom-virtual-memory = [] 395 396# Same as `custom-virtual-memory` above, but for custom signal-handling APIs. 397custom-native-signals = [] 398 399# Same as `custom-virtual-memory` above, but for custom sync primitive APIs. 400custom-sync-primitives = [] 401 402# Off-by-default support to profile the Pulley interpreter. This has a 403# performance hit, even when not profiling, so it's disabled by default at 404# compile time. 405profile-pulley = [ 406 "anyhow", 407 "profiling", 408 "pulley", 409 "pulley-interpreter/interp", 410 "pulley-interpreter/profile", 411] 412 413# Enables support for the Component Model Async ABI, along with `future`, 414# `stream`, and `error-context` types. 415component-model-async = [ 416 "async", 417 "component-model", 418 "std", 419 "wasmtime-component-macro?/component-model-async", 420 "dep:futures", 421 "futures/std", 422] 423 424# Enables support for `stream` interop with the `bytes` crate. 425component-model-async-bytes = [ 426 "component-model-async", 427 "dep:bytes", 428] 429 430# Enables support for guest debugging. 431debug = [ 432 'runtime', 433 'async' 434] 435 436# Enables support for defining compile-time builtins. 437compile-time-builtins = ['anyhow', 'dep:wasm-compose', 'dep:tempfile'] 438 439# Enable support for the common base infrastructure of record/replay 440rr = [ 441 "component-model", 442 "wasmtime-environ/rr" 443] 444