Repository: bytecodealliance/wasmtime
Pull request #4622 (2022-08-05 01:01:02)

Fix an issue in adapter module partitioning
When an adapter module depends on a particular core wasm instance this
means that it actually depends on not only that instance but all prior
core wasm instances as well. This is because core wasm instances must be
instantiated in the specified order within a component and that cannot
change depending on the dataflow between adapters. This commit fixes a
possible panic from linearizing the component dfg where an adapter
module tried to depend on an instance that hadn't been instantiated yet
because the ordering dependency between core wasm instances hadn't been
modeled.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

- [ ] This has been discussed in issue #..., or if not, please tell us why
  here.
- [ ] A short description of what this does, why it is needed; if the
  description becomes long, the matter should probably be discussed in an issue
  first.
- [ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
  If you don't know who could review this, please indicate so. The list of
  suggested reviewers on the right can help you.

Please ensure all communication adheres to the [code of
conduct](https://github.com/bytecodealliance/wasmtime/blob/master/CODE_OF_CONDUCT.md).
-->


alexcrichton: Note that for the test here I lifed it from https://github.com/bytecodealliance/wasmtime/pull/4605 and cleaned it up slightly

Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 4b4a8cd7d..518b7d8b0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -512,7 +512,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
  "cranelift-frontend",
@@ -520,14 +520,14 @@ dependencies = [
 
 [[package]]
 name = "cranelift-bforest"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-entity",
 ]
 
 [[package]]
 name = "cranelift-codegen"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "bincode",
  "cranelift-bforest",
@@ -549,18 +549,18 @@ dependencies = [
 
 [[package]]
 name = "cranelift-codegen-meta"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen-shared",
 ]
 
 [[package]]
 name = "cranelift-codegen-shared"
-version = "0.87.0"
+version = "0.88.0"
 
 [[package]]
 name = "cranelift-entity"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "serde",
 ]
@@ -589,7 +589,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-frontend"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
  "hashbrown",
@@ -610,7 +610,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-interpreter"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
  "cranelift-entity",
@@ -624,7 +624,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-isle"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "log",
  "miette",
@@ -633,7 +633,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-jit"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "anyhow",
  "cranelift",
@@ -652,7 +652,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-module"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -661,7 +661,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-native"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
  "libc",
@@ -670,7 +670,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-object"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -684,14 +684,14 @@ dependencies = [
 
 [[package]]
 name = "cranelift-preopt"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
 ]
 
 [[package]]
 name = "cranelift-reader"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
  "smallvec",
@@ -700,7 +700,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-serde"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "clap 3.2.8",
  "cranelift-codegen",
@@ -743,7 +743,7 @@ dependencies = [
 
 [[package]]
 name = "cranelift-wasm"
-version = "0.87.0"
+version = "0.88.0"
 dependencies = [
  "cranelift-codegen",
  "cranelift-entity",
@@ -3099,7 +3099,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
 
 [[package]]
 name = "wasi-cap-std-sync"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3122,7 +3122,7 @@ dependencies = [
 
 [[package]]
 name = "wasi-common"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "bitflags",
@@ -3167,7 +3167,7 @@ dependencies = [
 
 [[package]]
 name = "wasi-tokio"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "cap-std",
@@ -3327,7 +3327,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3361,7 +3361,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-asm-macros"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "cfg-if",
 ]
@@ -3408,7 +3408,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-cache"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "base64",
@@ -3430,7 +3430,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-cli"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3471,7 +3471,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-cli-flags"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "clap 3.2.8",
@@ -3483,7 +3483,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-component-macro"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3493,11 +3493,11 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-component-util"
-version = "0.40.0"
+version = "0.41.0"
 
 [[package]]
 name = "wasmtime-cranelift"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -3516,7 +3516,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-environ"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "atty",
@@ -3553,7 +3553,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-fiber"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "backtrace",
  "cc",
@@ -3615,7 +3615,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-jit"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "addr2line",
  "anyhow",
@@ -3639,7 +3639,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-jit-debug"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "object",
  "once_cell",
@@ -3648,7 +3648,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-runtime"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "cc",
@@ -3672,7 +3672,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-types"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "cranelift-entity",
  "serde",
@@ -3682,7 +3682,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wasi"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "wasi-cap-std-sync",
@@ -3694,7 +3694,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wasi-crypto"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "wasi-crypto",
@@ -3704,7 +3704,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wasi-nn"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "openvino",
@@ -3715,7 +3715,7 @@ dependencies = [
 
 [[package]]
 name = "wasmtime-wast"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "log",
@@ -3776,7 +3776,7 @@ dependencies = [
 
 [[package]]
 name = "wiggle"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -3793,7 +3793,7 @@ dependencies = [
 
 [[package]]
 name = "wiggle-generate"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "anyhow",
  "heck",
@@ -3806,7 +3806,7 @@ dependencies = [
 
 [[package]]
 name = "wiggle-macro"
-version = "0.40.0"
+version = "0.41.0"
 dependencies = [
  "proc-macro2",
  "quote",
diff --git a/Cargo.toml b/Cargo.toml
index 6b6db5789..9cd9ad201 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cli"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Command-line interface for Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -21,15 +21,15 @@ path = "src/bin/wasmtime.rs"
 doc = false
 
 [dependencies]
-wasmtime = { path = "crates/wasmtime", version = "0.40.0", default-features = false, features = ['cache', 'cranelift'] }
-wasmtime-cache = { path = "crates/cache", version = "=0.40.0" }
-wasmtime-cli-flags = { path = "crates/cli-flags", version = "=0.40.0" }
-wasmtime-cranelift = { path = "crates/cranelift", version = "=0.40.0" }
-wasmtime-environ = { path = "crates/environ", version = "=0.40.0" }
-wasmtime-wast = { path = "crates/wast", version = "=0.40.0" }
-wasmtime-wasi = { path = "crates/wasi", version = "0.40.0" }
-wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.40.0", optional = true }
-wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.40.0", optional = true }
+wasmtime = { path = "crates/wasmtime", version = "0.41.0", default-features = false, features = ['cache', 'cranelift'] }
+wasmtime-cache = { path = "crates/cache", version = "=0.41.0" }
+wasmtime-cli-flags = { path = "crates/cli-flags", version = "=0.41.0" }
+wasmtime-cranelift = { path = "crates/cranelift", version = "=0.41.0" }
+wasmtime-environ = { path = "crates/environ", version = "=0.41.0" }
+wasmtime-wast = { path = "crates/wast", version = "=0.41.0" }
+wasmtime-wasi = { path = "crates/wasi", version = "0.41.0" }
+wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.41.0", optional = true }
+wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.41.0", optional = true }
 clap = { version = "3.2.0", features = ["color", "suggestions", "derive"] }
 anyhow = "1.0.19"
 target-lexicon = { version = "0.12.0", default-features = false }
@@ -43,7 +43,7 @@ rustix = { version = "0.35.6", features = ["mm", "param"] }
 
 [dev-dependencies]
 # depend again on wasmtime to activate its default features for tests
-wasmtime = { path = "crates/wasmtime", version = "0.40.0", features = ['component-model'] }
+wasmtime = { path = "crates/wasmtime", version = "0.41.0", features = ['component-model'] }
 env_logger = "0.9.0"
 filecheck = "0.5.0"
 tempfile = "3.1.0"
@@ -60,7 +60,7 @@ wat = "1.0.47"
 once_cell = "1.9.0"
 rayon = "1.5.0"
 component-macro-test = { path = "crates/misc/component-macro-test" }
-wasmtime-wast = { path = "crates/wast", version = "=0.40.0", features = ['component-model'] }
+wasmtime-wast = { path = "crates/wast", version = "=0.41.0", features = ['component-model'] }
 component-test-util = { path = "crates/misc/component-test-util" }
 wasmtime-component-util = { path = "crates/component-util" }
 
diff --git a/RELEASES.md b/RELEASES.md
index 2c2319636..1a8ec444f 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -1,5 +1,15 @@
 --------------------------------------------------------------------------------
 
+## 0.41.0
+
+Unreleased.
+
+### Added
+
+### Changed
+
+--------------------------------------------------------------------------------
+
 ## 0.40.0
 
 Unreleased.
diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.toml
index 445a2ffa3..a783ff58b 100644
--- a/cranelift/Cargo.toml
+++ b/cranelift/Cargo.toml
@@ -15,19 +15,19 @@ path = "src/clif-util.rs"
 
 [dependencies]
 cfg-if = "1.0"
-cranelift-codegen = { path = "codegen", version = "0.87.0" }
-cranelift-entity = { path = "entity", version = "0.87.0" }
-cranelift-interpreter = { path = "interpreter", version = "0.87.0" }
-cranelift-reader = { path = "reader", version = "0.87.0" }
-cranelift-frontend = { path = "frontend", version = "0.87.0" }
-cranelift-wasm = { path = "wasm", version = "0.87.0", optional = true }
-cranelift-native = { path = "native", version = "0.87.0" }
+cranelift-codegen = { path = "codegen", version = "0.88.0" }
+cranelift-entity = { path = "entity", version = "0.88.0" }
+cranelift-interpreter = { path = "interpreter", version = "0.88.0" }
+cranelift-reader = { path = "reader", version = "0.88.0" }
+cranelift-frontend = { path = "frontend", version = "0.88.0" }
+cranelift-wasm = { path = "wasm", version = "0.88.0", optional = true }
+cranelift-native = { path = "native", version = "0.88.0" }
 cranelift-filetests = { path = "filetests", version = "0.73.0" }
-cranelift-module = { path = "module", version = "0.87.0" }
-cranelift-object = { path = "object", version = "0.87.0" }
-cranelift-jit = { path = "jit", version = "0.87.0" }
-cranelift-preopt = { path = "preopt", version = "0.87.0" }
-cranelift = { path = "umbrella", version = "0.87.0" }
+cranelift-module = { path = "module", version = "0.88.0" }
+cranelift-object = { path = "object", version = "0.88.0" }
+cranelift-jit = { path = "jit", version = "0.88.0" }
+cranelift-preopt = { path = "preopt", version = "0.88.0" }
+cranelift = { path = "umbrella", version = "0.88.0" }
 filecheck = "0.5.0"
 log = "0.4.8"
 termcolor = "1.1.2"
diff --git a/cranelift/bforest/Cargo.toml b/cranelift/bforest/Cargo.toml
index 870607a86..eae0dc75b 100644
--- a/cranelift/bforest/Cargo.toml
+++ b/cranelift/bforest/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-bforest"
-version = "0.87.0"
+version = "0.88.0"
 description = "A forest of B+-trees"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-bforest"
@@ -12,7 +12,7 @@ keywords = ["btree", "forest", "set", "map"]
 edition = "2021"
 
 [dependencies]
-cranelift-entity = { path = "../entity", version = "0.87.0", default-features = false }
+cranelift-entity = { path = "../entity", version = "0.88.0", default-features = false }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml
index 990730176..dbc919cf6 100644
--- a/cranelift/codegen/Cargo.toml
+++ b/cranelift/codegen/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-codegen"
-version = "0.87.0"
+version = "0.88.0"
 description = "Low-level code generator library"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-codegen"
@@ -13,9 +13,9 @@ build = "build.rs"
 edition = "2021"
 
 [dependencies]
-cranelift-codegen-shared = { path = "./shared", version = "0.87.0" }
-cranelift-entity = { path = "../entity", version = "0.87.0" }
-cranelift-bforest = { path = "../bforest", version = "0.87.0" }
+cranelift-codegen-shared = { path = "./shared", version = "0.88.0" }
+cranelift-entity = { path = "../entity", version = "0.88.0" }
+cranelift-bforest = { path = "../bforest", version = "0.88.0" }
 hashbrown = { version = "0.12", optional = true }
 target-lexicon = "0.12"
 log = { version = "0.4.6", default-features = false }
@@ -34,8 +34,8 @@ souper-ir = { version = "2.1.0", optional = true }
 criterion = "0.3"
 
 [build-dependencies]
-cranelift-codegen-meta = { path = "meta", version = "0.87.0" }
-cranelift-isle = { path = "../isle/isle", version = "=0.87.0" }
+cranelift-codegen-meta = { path = "meta", version = "0.88.0" }
+cranelift-isle = { path = "../isle/isle", version = "=0.88.0" }
 miette = { version = "5.1.0", features = ["fancy"], optional = true }
 
 [features]
diff --git a/cranelift/codegen/meta/Cargo.toml b/cranelift/codegen/meta/Cargo.toml
index 5716637b7..93bc62aab 100644
--- a/cranelift/codegen/meta/Cargo.toml
+++ b/cranelift/codegen/meta/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "cranelift-codegen-meta"
 authors = ["The Cranelift Project Developers"]
-version = "0.87.0"
+version = "0.88.0"
 description = "Metaprogram for cranelift-codegen code generator library"
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -13,7 +13,7 @@ edition = "2021"
 # rustdoc-args = [ "--document-private-items" ]
 
 [dependencies]
-cranelift-codegen-shared = { path = "../shared", version = "0.87.0" }
+cranelift-codegen-shared = { path = "../shared", version = "0.88.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/codegen/shared/Cargo.toml b/cranelift/codegen/shared/Cargo.toml
index 40cb546f9..936799cab 100644
--- a/cranelift/codegen/shared/Cargo.toml
+++ b/cranelift/codegen/shared/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-codegen-shared"
-version = "0.87.0"
+version = "0.88.0"
 description = "For code shared between cranelift-codegen-meta and cranelift-codegen"
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasmtime"
diff --git a/cranelift/entity/Cargo.toml b/cranelift/entity/Cargo.toml
index 10c88dd7a..b0e934038 100644
--- a/cranelift/entity/Cargo.toml
+++ b/cranelift/entity/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-entity"
-version = "0.87.0"
+version = "0.88.0"
 description = "Data structures using entity references as mapping keys"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-entity"
diff --git a/cranelift/frontend/Cargo.toml b/cranelift/frontend/Cargo.toml
index 55bb630e5..72830d1dd 100644
--- a/cranelift/frontend/Cargo.toml
+++ b/cranelift/frontend/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-frontend"
-version = "0.87.0"
+version = "0.88.0"
 description = "Cranelift IR builder helper"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-frontend"
@@ -11,7 +11,7 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
 target-lexicon = "0.12"
 log = { version = "0.4.6", default-features = false }
 hashbrown = { version = "0.12", optional = true }
diff --git a/cranelift/fuzzgen/Cargo.toml b/cranelift/fuzzgen/Cargo.toml
index c461a1803..cc38b15c7 100644
--- a/cranelift/fuzzgen/Cargo.toml
+++ b/cranelift/fuzzgen/Cargo.toml
@@ -11,8 +11,8 @@ publish = false
 
 
 [dependencies]
-cranelift = { path = "../umbrella", version = "0.87.0" }
-cranelift-native = { path = "../native", version = "0.87.0" }
+cranelift = { path = "../umbrella", version = "0.88.0" }
+cranelift-native = { path = "../native", version = "0.88.0" }
 
 anyhow = "1.0.19"
 arbitrary = "1.0.0"
diff --git a/cranelift/interpreter/Cargo.toml b/cranelift/interpreter/Cargo.toml
index 26b7733be..caa7b9775 100644
--- a/cranelift/interpreter/Cargo.toml
+++ b/cranelift/interpreter/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-interpreter"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "Interpret Cranelift IR"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -11,8 +11,8 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0" }
-cranelift-entity = { path = "../entity", version = "0.87.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0" }
+cranelift-entity = { path = "../entity", version = "0.88.0" }
 log = { version = "0.4.8", default-features = false }
 smallvec = "1.6.1"
 thiserror = "1.0.15"
@@ -21,8 +21,8 @@ thiserror = "1.0.15"
 libm = "0.2"
 
 [dev-dependencies]
-cranelift-frontend = { path = "../frontend", version = "0.87.0" }
-cranelift-reader = { path = "../reader", version = "0.87.0" }
+cranelift-frontend = { path = "../frontend", version = "0.88.0" }
+cranelift-reader = { path = "../reader", version = "0.88.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/isle/isle/Cargo.toml b/cranelift/isle/isle/Cargo.toml
index 726bd6ac4..4c21ff916 100644
--- a/cranelift/isle/isle/Cargo.toml
+++ b/cranelift/isle/isle/Cargo.toml
@@ -6,7 +6,7 @@ license = "Apache-2.0 WITH LLVM-exception"
 name = "cranelift-isle"
 readme = "../README.md"
 repository = "https://github.com/bytecodealliance/wasmtime/tree/main/cranelift/isle"
-version = "0.87.0"
+version = "0.88.0"
 
 [dependencies]
 log = { version = "0.4", optional = true }
diff --git a/cranelift/jit/Cargo.toml b/cranelift/jit/Cargo.toml
index 594bd784a..cb18e23e1 100644
--- a/cranelift/jit/Cargo.toml
+++ b/cranelift/jit/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-jit"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "A JIT library backed by Cranelift"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -10,10 +10,10 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-module = { path = "../module", version = "0.87.0" }
-cranelift-native = { path = "../native", version = "0.87.0" }
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false, features = ["std"] }
-cranelift-entity = { path = "../entity", version = "0.87.0" }
+cranelift-module = { path = "../module", version = "0.88.0" }
+cranelift-native = { path = "../native", version = "0.88.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false, features = ["std"] }
+cranelift-entity = { path = "../entity", version = "0.88.0" }
 anyhow = "1.0"
 region = "2.2.0"
 libc = { version = "0.2.42" }
@@ -34,9 +34,9 @@ selinux-fix = ['memmap2']
 default = []
 
 [dev-dependencies]
-cranelift = { path = "../umbrella", version = "0.87.0" }
-cranelift-frontend = { path = "../frontend", version = "0.87.0" }
-cranelift-entity = { path = "../entity", version = "0.87.0" }
+cranelift = { path = "../umbrella", version = "0.88.0" }
+cranelift-frontend = { path = "../frontend", version = "0.88.0" }
+cranelift-entity = { path = "../entity", version = "0.88.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/module/Cargo.toml b/cranelift/module/Cargo.toml
index 33f096ed9..63f50042d 100644
--- a/cranelift/module/Cargo.toml
+++ b/cranelift/module/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-module"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "Support for linking functions and data with Cranelift"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -11,7 +11,7 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
 hashbrown = { version = "0.12", optional = true }
 anyhow = "1.0"
 
diff --git a/cranelift/native/Cargo.toml b/cranelift/native/Cargo.toml
index d0038fc9c..952345d92 100644
--- a/cranelift/native/Cargo.toml
+++ b/cranelift/native/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-native"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "Support for targeting the host with Cranelift"
 documentation = "https://docs.rs/cranelift-native"
@@ -11,7 +11,7 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
 target-lexicon = "0.12"
 
 [target.'cfg(target_arch = "s390x")'.dependencies]
diff --git a/cranelift/object/Cargo.toml b/cranelift/object/Cargo.toml
index bd81c670c..3d977c49b 100644
--- a/cranelift/object/Cargo.toml
+++ b/cranelift/object/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-object"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "Emit Cranelift output to native object files with `object`"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -10,16 +10,16 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-module = { path = "../module", version = "0.87.0" }
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false, features = ["std"] }
+cranelift-module = { path = "../module", version = "0.88.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false, features = ["std"] }
 object = { version = "0.29.0", default-features = false, features = ["write"] }
 target-lexicon = "0.12"
 anyhow = "1.0"
 log = { version = "0.4.6", default-features = false }
 
 [dev-dependencies]
-cranelift-frontend = { path = "../frontend", version = "0.87.0" }
-cranelift-entity = { path = "../entity", version = "0.87.0" }
+cranelift-frontend = { path = "../frontend", version = "0.88.0" }
+cranelift-entity = { path = "../entity", version = "0.88.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/preopt/Cargo.toml b/cranelift/preopt/Cargo.toml
index ea05b775d..e0a905b22 100644
--- a/cranelift/preopt/Cargo.toml
+++ b/cranelift/preopt/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-preopt"
-version = "0.87.0"
+version = "0.88.0"
 description = "Support for optimizations in Cranelift"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-preopt"
@@ -12,7 +12,7 @@ keywords = ["optimize", "compile", "compiler", "jit"]
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
 # This is commented out because it doesn't build on Rust 1.25.0, which
 # cranelift currently supports.
 # rustc_apfloat = { version = "0.1.2", default-features = false }
diff --git a/cranelift/reader/Cargo.toml b/cranelift/reader/Cargo.toml
index be876aa66..eb4854ed4 100644
--- a/cranelift/reader/Cargo.toml
+++ b/cranelift/reader/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift-reader"
-version = "0.87.0"
+version = "0.88.0"
 description = "Cranelift textual IR reader"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift-reader"
@@ -10,7 +10,7 @@ readme = "README.md"
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0" }
 smallvec = "1.6.1"
 target-lexicon = "0.12"
 
diff --git a/cranelift/serde/Cargo.toml b/cranelift/serde/Cargo.toml
index c0ac9fc6f..6839bbe71 100644
--- a/cranelift/serde/Cargo.toml
+++ b/cranelift/serde/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-serde"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "Serializer/Deserializer for Cranelift IR"
 repository = "https://github.com/bytecodealliance/wasmtime"
@@ -16,8 +16,8 @@ path = "src/clif-json.rs"
 [dependencies]
 clap = { version = "3.2.0", features = ["derive"] }
 serde_json = "1.0.26"
-cranelift-codegen = { path = "../codegen", version = "0.87.0", features = ["enable-serde"] }
-cranelift-reader = { path = "../reader", version = "0.87.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", features = ["enable-serde"] }
+cranelift-reader = { path = "../reader", version = "0.88.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/cranelift/umbrella/Cargo.toml b/cranelift/umbrella/Cargo.toml
index a7b8f0106..9773ae223 100644
--- a/cranelift/umbrella/Cargo.toml
+++ b/cranelift/umbrella/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 authors = ["The Cranelift Project Developers"]
 name = "cranelift"
-version = "0.87.0"
+version = "0.88.0"
 description = "Umbrella for commonly-used cranelift crates"
 license = "Apache-2.0 WITH LLVM-exception"
 documentation = "https://docs.rs/cranelift"
@@ -12,8 +12,8 @@ keywords = ["compile", "compiler", "jit"]
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
-cranelift-frontend = { path = "../frontend", version = "0.87.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
+cranelift-frontend = { path = "../frontend", version = "0.88.0", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/cranelift/wasm/Cargo.toml b/cranelift/wasm/Cargo.toml
index ac7950370..0e89f9d3a 100644
--- a/cranelift/wasm/Cargo.toml
+++ b/cranelift/wasm/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cranelift-wasm"
-version = "0.87.0"
+version = "0.88.0"
 authors = ["The Cranelift Project Developers"]
 description = "Translator from WebAssembly to Cranelift IR"
 documentation = "https://docs.rs/cranelift-wasm"
@@ -13,10 +13,10 @@ edition = "2021"
 
 [dependencies]
 wasmparser = { version = "0.88.0", default-features = false }
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
-cranelift-entity = { path = "../entity", version = "0.87.0" }
-cranelift-frontend = { path = "../frontend", version = "0.87.0", default-features = false }
-wasmtime-types = { path = "../../crates/types", version = "0.40.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
+cranelift-entity = { path = "../entity", version = "0.88.0" }
+cranelift-frontend = { path = "../frontend", version = "0.88.0", default-features = false }
+wasmtime-types = { path = "../../crates/types", version = "0.41.0" }
 hashbrown = { version = "0.12", optional = true }
 itertools = "0.10.0"
 log = { version = "0.4.6", default-features = false }
@@ -26,7 +26,7 @@ smallvec = "1.6.1"
 [dev-dependencies]
 wat = "1.0.47"
 target-lexicon = "0.12"
-cranelift-codegen = { path = "../codegen", version = "0.87.0", default-features = false }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/crates/asm-macros/Cargo.toml b/crates/asm-macros/Cargo.toml
index 2c853b00d..5aebdcb41 100644
--- a/crates/asm-macros/Cargo.toml
+++ b/crates/asm-macros/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2021"
 license = "Apache-2.0 WITH LLVM-exception"
 name = "wasmtime-asm-macros"
 repository = "https://github.com/bytecodealliance/wasmtime"
-version = "0.40.0"
+version = "0.41.0"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
diff --git a/crates/cache/Cargo.toml b/crates/cache/Cargo.toml
index 1657a46e1..36ad2694b 100644
--- a/crates/cache/Cargo.toml
+++ b/crates/cache/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cache"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Support for automatic module caching with Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/cli-flags/Cargo.toml b/crates/cli-flags/Cargo.toml
index 863471ce2..ef8d87419 100644
--- a/crates/cli-flags/Cargo.toml
+++ b/crates/cli-flags/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cli-flags"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Exposes common CLI flags used for running Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -14,7 +14,7 @@ clap = { version = "3.2.0", features = ["color", "suggestions", "derive"] }
 file-per-thread-logger = "0.1.1"
 pretty_env_logger = "0.4.0"
 rayon = "1.5.0"
-wasmtime = { path = "../wasmtime", version = "0.40.0", default-features = false }
+wasmtime = { path = "../wasmtime", version = "0.41.0", default-features = false }
 
 [features]
 default = [
diff --git a/crates/component-macro/Cargo.toml b/crates/component-macro/Cargo.toml
index 2997bb76c..6ca751501 100644
--- a/crates/component-macro/Cargo.toml
+++ b/crates/component-macro/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-component-macro"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Macros for deriving component interface types from Rust types"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -17,7 +17,7 @@ proc-macro = true
 proc-macro2 = "1.0"
 quote = "1.0"
 syn = { version = "1.0", features = ["extra-traits"] }
-wasmtime-component-util = { path = "../component-util", version = "=0.40.0" }
+wasmtime-component-util = { path = "../component-util", version = "=0.41.0" }
 
 [badges]
 maintenance = { status = "actively-developed" }
diff --git a/crates/component-util/Cargo.toml b/crates/component-util/Cargo.toml
index 6de2d6460..e125df8a2 100644
--- a/crates/component-util/Cargo.toml
+++ b/crates/component-util/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-component-util"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Utility types and functions to support the component model in Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/cranelift/Cargo.toml b/crates/cranelift/Cargo.toml
index bc69e7b7e..23df5dd71 100644
--- a/crates/cranelift/Cargo.toml
+++ b/crates/cranelift/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-cranelift"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Integration between Cranelift and Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -13,12 +13,12 @@ edition = "2021"
 [dependencies]
 anyhow = "1.0"
 log = "0.4"
-wasmtime-environ = { path = "../environ", version = "=0.40.0" }
-cranelift-wasm = { path = "../../cranelift/wasm", version = "0.87.0" }
-cranelift-codegen = { path = "../../cranelift/codegen", version = "0.87.0" }
-cranelift-frontend = { path = "../../cranelift/frontend", version = "0.87.0" }
-cranelift-entity = { path = "../../cranelift/entity", version = "0.87.0" }
-cranelift-native = { path = "../../cranelift/native", version = "0.87.0" }
+wasmtime-environ = { path = "../environ", version = "=0.41.0" }
+cranelift-wasm = { path = "../../cranelift/wasm", version = "0.88.0" }
+cranelift-codegen = { path = "../../cranelift/codegen", version = "0.88.0" }
+cranelift-frontend = { path = "../../cranelift/frontend", version = "0.88.0" }
+cranelift-entity = { path = "../../cranelift/entity", version = "0.88.0" }
+cranelift-native = { path = "../../cranelift/native", version = "0.88.0" }
 wasmparser = "0.88.0"
 target-lexicon = "0.12"
 gimli = { version = "0.26.0", default-features = false, features = ['read', 'std'] }
diff --git a/crates/environ/Cargo.toml b/crates/environ/Cargo.toml
index 1c4a3701a..412cbaeb7 100644
--- a/crates/environ/Cargo.toml
+++ b/crates/environ/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-environ"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Standalone environment support for WebAsssembly code in Cranelift"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -12,8 +12,8 @@ edition = "2021"
 
 [dependencies]
 anyhow = "1.0"
-cranelift-entity = { path = "../../cranelift/entity", version = "0.87.0" }
-wasmtime-types = { path = "../types", version = "0.40.0" }
+cranelift-entity = { path = "../../cranelift/entity", version = "0.88.0" }
+wasmtime-types = { path = "../types", version = "0.41.0" }
 wasmparser = "0.88.0"
 indexmap = { version = "1.0.2", features = ["serde-1"] }
 thiserror = "1.0.4"
@@ -24,7 +24,7 @@ object = { version = "0.29.0", default-features = false, features = ['read_core'
 target-lexicon = "0.12"
 wasm-encoder = { version = "0.15.0", optional = true }
 wasmprinter = { version = "0.2.38", optional = true }
-wasmtime-component-util = { path = "../component-util", version = "=0.40.0", optional = true }
+wasmtime-component-util = { path = "../component-util", version = "=0.41.0", optional = true }
 
 [dev-dependencies]
 atty = "0.2.14"
diff --git a/crates/environ/src/component/dfg.rs b/crates/environ/src/component/dfg.rs
index 4b059177e..7aa35d603 100644
--- a/crates/environ/src/component/dfg.rs
+++ b/crates/environ/src/component/dfg.rs
@@ -352,6 +352,7 @@ enum RuntimeInstance {
 
 impl LinearizeDfg<'_> {
     fn instantiate(&mut self, instance: InstanceId, args: &Instance) {
+        log::trace!("creating instance {instance:?}");
         let instantiation = match args {
             Instance::Static(index, args) => InstantiateModule::Static(
                 *index,
@@ -500,8 +501,10 @@ impl LinearizeDfg<'_> {
     where
         T: Clone,
     {
+        let instance = export.instance;
+        log::trace!("referencing export of {instance:?}");
         info::CoreExport {
-            instance: self.runtime_instances[&RuntimeInstance::Normal(export.instance)],
+            instance: self.runtime_instances[&RuntimeInstance::Normal(instance)],
             item: export.item.clone(),
         }
     }
diff --git a/crates/environ/src/component/translate/adapt.rs b/crates/environ/src/component/translate/adapt.rs
index ab5b7e403..7289bb555 100644
--- a/crates/environ/src/component/translate/adapt.rs
+++ b/crates/environ/src/component/translate/adapt.rs
@@ -296,7 +296,7 @@ impl PartitionAdapterModules {
         // didn't depend on anything in that module itself or it will be added
         // to a fresh module if this adapter depended on something that the
         // current adapter module created.
-        log::debug!("adding {id:?} to adapter module {adapter:#?}");
+        log::debug!("adding {id:?} to adapter module");
         self.next_module.adapters.push(id);
     }
 
@@ -319,9 +319,12 @@ impl PartitionAdapterModules {
                 // If this adapter is already defined then we can safely depend
                 // on it with no consequences.
                 if self.defined_items.contains(&Def::Adapter(*id)) {
+                    log::debug!("using existing adapter {id:?} ");
                     return;
                 }
 
+                log::debug!("splitting module needing {id:?} ");
+
                 // .. otherwise we found a case of an adapter depending on an
                 // adapter-module-in-progress meaning that the current adapter
                 // module must be completed and then a new one is started.
@@ -337,16 +340,33 @@ impl PartitionAdapterModules {
     }
 
     fn core_export<T>(&mut self, dfg: &dfg::ComponentDfg, export: &dfg::CoreExport<T>) {
-        // If this instance has already been visited that means it can already
-        // be defined for this adapter module, so nothing else needs to be done.
-        if !self.defined_items.insert(Def::Instance(export.instance)) {
-            return;
+        // When an adapter depends on an exported item it actually depends on
+        // the instance of that exported item. The caveat here is that the
+        // adapter not only depends on that particular instance, but also all
+        // prior instances to that instance as well because instance
+        // instantiation order is fixed and cannot change.
+        //
+        // To model this the instance index space is looped over here and while
+        // an instance hasn't been visited it's visited. Note that if an
+        // instance has already been visited then all prior instances have
+        // already been visited so there's no need to continue.
+        let mut instance = export.instance;
+        while self.defined_items.insert(Def::Instance(instance)) {
+            self.instance(dfg, instance);
+            if instance.as_u32() == 0 {
+                break;
+            }
+            instance = dfg::InstanceId::from_u32(instance.as_u32() - 1);
         }
+    }
+
+    fn instance(&mut self, dfg: &dfg::ComponentDfg, instance: dfg::InstanceId) {
+        log::debug!("visiting instance {instance:?}");
 
         // ... otherwise if this is the first timet he instance has been seen
         // then the instances own arguments are recursively visited to find
         // transitive dependencies on adapters.
-        match &dfg.instances[export.instance] {
+        match &dfg.instances[instance] {
             dfg::Instance::Static(_, args) => {
                 for arg in args.iter() {
                     self.core_def(dfg, arg);
diff --git a/crates/fiber/Cargo.toml b/crates/fiber/Cargo.toml
index 61cf5ed4f..12cfae58d 100644
--- a/crates/fiber/Cargo.toml
+++ b/crates/fiber/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-fiber"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Fiber support for Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -18,7 +18,7 @@ cfg-if = "1.0"
 
 [target.'cfg(unix)'.dependencies]
 rustix = { version = "0.35.6", features = ["mm", "param"] }
-wasmtime-asm-macros = { version = "=0.40.0", path = "../asm-macros" }
+wasmtime-asm-macros = { version = "=0.41.0", path = "../asm-macros" }
 
 [target.'cfg(windows)'.dependencies.windows-sys]
 version = "0.36.1"
diff --git a/crates/jit-debug/Cargo.toml b/crates/jit-debug/Cargo.toml
index db8206678..b119e0314 100644
--- a/crates/jit-debug/Cargo.toml
+++ b/crates/jit-debug/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-jit-debug"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "JIT debug interfaces support for Wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml
index 74ae56c0a..29fb1f4ee 100644
--- a/crates/jit/Cargo.toml
+++ b/crates/jit/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-jit"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "JIT-style execution for WebAsssembly code in Cranelift"
 documentation = "https://docs.rs/wasmtime-jit"
@@ -11,9 +11,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
 edition = "2021"
 
 [dependencies]
-wasmtime-environ = { path = "../environ", version = "=0.40.0" }
-wasmtime-jit-debug = { path = "../jit-debug", version = "=0.40.0", features = ["perf_jitdump"], optional = true }
-wasmtime-runtime = { path = "../runtime", version = "=0.40.0" }
+wasmtime-environ = { path = "../environ", version = "=0.41.0" }
+wasmtime-jit-debug = { path = "../jit-debug", version = "=0.41.0", features = ["perf_jitdump"], optional = true }
+wasmtime-runtime = { path = "../runtime", version = "=0.41.0" }
 thiserror = "1.0.4"
 target-lexicon = { version = "0.12.0", default-features = false }
 anyhow = "1.0"
diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml
index 02bd231af..f209a2459 100644
--- a/crates/runtime/Cargo.toml
+++ b/crates/runtime/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-runtime"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Runtime library support for Wasmtime"
 documentation = "https://docs.rs/wasmtime-runtime"
@@ -11,10 +11,10 @@ repository = "https://github.com/bytecodealliance/wasmtime"
 edition = "2021"
 
 [dependencies]
-wasmtime-asm-macros = { path = "../asm-macros", version = "=0.40.0" }
-wasmtime-environ = { path = "../environ", version = "=0.40.0" }
-wasmtime-fiber = { path = "../fiber", version = "=0.40.0", optional = true }
-wasmtime-jit-debug = { path = "../jit-debug", version = "=0.40.0", features = ["gdb_jit_int"] }
+wasmtime-asm-macros = { path = "../asm-macros", version = "=0.41.0" }
+wasmtime-environ = { path = "../environ", version = "=0.41.0" }
+wasmtime-fiber = { path = "../fiber", version = "=0.41.0", optional = true }
+wasmtime-jit-debug = { path = "../jit-debug", version = "=0.41.0", features = ["gdb_jit_int"] }
 libc = { version = "0.2.112", default-features = false }
 log = "0.4.8"
 memoffset = "0.6.0"
diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml
index 1471aec55..6cacf5850 100644
--- a/crates/types/Cargo.toml
+++ b/crates/types/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-types"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WebAssembly type definitions for Cranelift"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasmtime-types"
 edition = "2021"
 
 [dependencies]
-cranelift-entity = { path = "../../cranelift/entity", version = "0.87.0", features = ['enable-serde'] }
+cranelift-entity = { path = "../../cranelift/entity", version = "0.88.0", features = ['enable-serde'] }
 serde = { version = "1.0.94", features = ["derive"] }
 thiserror = "1.0.4"
 wasmparser = { version = "0.88.0", default-features = false }
diff --git a/crates/wasi-common/Cargo.toml b/crates/wasi-common/Cargo.toml
index 28a428c1e..3bd7baf47 100644
--- a/crates/wasi-common/Cargo.toml
+++ b/crates/wasi-common/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasi-common"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -20,7 +20,7 @@ links = "wasi-common-19"
 [dependencies]
 anyhow = "1.0"
 thiserror = "1.0"
-wiggle = { path = "../wiggle", default-features = false, version = "=0.40.0" }
+wiggle = { path = "../wiggle", default-features = false, version = "=0.41.0" }
 tracing = "0.1.19"
 cap-std = "0.25.0"
 cap-rand = "0.25.0"
diff --git a/crates/wasi-common/cap-std-sync/Cargo.toml b/crates/wasi-common/cap-std-sync/Cargo.toml
index d0a192c9f..d93b534ff 100644
--- a/crates/wasi-common/cap-std-sync/Cargo.toml
+++ b/crates/wasi-common/cap-std-sync/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasi-cap-std-sync"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -12,7 +12,7 @@ edition = "2021"
 include = ["src/**/*", "README.md", "LICENSE" ]
 
 [dependencies]
-wasi-common = { path = "../", version = "=0.40.0" }
+wasi-common = { path = "../", version = "=0.41.0" }
 async-trait = "0.1"
 anyhow = "1.0"
 cap-std = "0.25.0"
diff --git a/crates/wasi-common/tokio/Cargo.toml b/crates/wasi-common/tokio/Cargo.toml
index b7a996894..8ee2ea8d2 100644
--- a/crates/wasi-common/tokio/Cargo.toml
+++ b/crates/wasi-common/tokio/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasi-tokio"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -11,9 +11,9 @@ edition = "2021"
 include = ["src/**/*", "LICENSE" ]
 
 [dependencies]
-wasi-common = { path = "../", version = "=0.40.0" }
-wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.40.0" }
-wiggle = { path = "../../wiggle", version = "=0.40.0" }
+wasi-common = { path = "../", version = "=0.41.0" }
+wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.41.0" }
+wiggle = { path = "../../wiggle", version = "=0.41.0" }
 tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
 cap-std = "0.25.0"
 anyhow = "1"
diff --git a/crates/wasi-crypto/Cargo.toml b/crates/wasi-crypto/Cargo.toml
index e392ea410..069a2d743 100644
--- a/crates/wasi-crypto/Cargo.toml
+++ b/crates/wasi-crypto/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wasi-crypto"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Wasmtime implementation of the wasi-crypto API"
 documentation = "https://docs.rs/wasmtime-wasi-crypto"
@@ -14,8 +14,8 @@ edition = "2021"
 [dependencies]
 anyhow = "1.0"
 wasi-crypto = { path = "spec/implementations/hostcalls/rust", version = "0.1.5" }
-wasmtime = { path = "../wasmtime", version = "0.40.0", default-features = false }
-wiggle = { path = "../wiggle", version = "=0.40.0" }
+wasmtime = { path = "../wasmtime", version = "0.41.0", default-features = false }
+wiggle = { path = "../wiggle", version = "=0.41.0" }
 
 [badges]
 maintenance = { status = "experimental" }
diff --git a/crates/wasi-nn/Cargo.toml b/crates/wasi-nn/Cargo.toml
index 69714bdf0..e8186bb0a 100644
--- a/crates/wasi-nn/Cargo.toml
+++ b/crates/wasi-nn/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wasi-nn"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "Wasmtime implementation of the wasi-nn API"
 documentation = "https://docs.rs/wasmtime-wasi-nn"
@@ -14,7 +14,7 @@ edition = "2021"
 [dependencies]
 # These dependencies are necessary for the witx-generation macros to work:
 anyhow = "1.0"
-wiggle = { path = "../wiggle", version = "=0.40.0" }
+wiggle = { path = "../wiggle", version = "=0.41.0" }
 
 # These dependencies are necessary for the wasi-nn implementation:
 openvino = { version = "0.4.1", features = ["runtime-linking"] }
diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml
index ba3a298e8..cc4060432 100644
--- a/crates/wasi/Cargo.toml
+++ b/crates/wasi/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wasi"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "WASI implementation in Rust"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -13,11 +13,11 @@ include = ["src/**/*", "README.md", "LICENSE", "build.rs"]
 build = "build.rs"
 
 [dependencies]
-wasi-common = { path = "../wasi-common", version = "=0.40.0" }
-wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "=0.40.0", optional = true }
-wasi-tokio = { path = "../wasi-common/tokio", version = "=0.40.0", optional = true }
-wiggle = { path = "../wiggle", default-features = false, version = "=0.40.0", features = ["wasmtime_integration"] }
-wasmtime = { path = "../wasmtime", default-features = false, version = "0.40.0" }
+wasi-common = { path = "../wasi-common", version = "=0.41.0" }
+wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "=0.41.0", optional = true }
+wasi-tokio = { path = "../wasi-common/tokio", version = "=0.41.0", optional = true }
+wiggle = { path = "../wiggle", default-features = false, version = "=0.41.0", features = ["wasmtime_integration"] }
+wasmtime = { path = "../wasmtime", default-features = false, version = "0.41.0" }
 anyhow = "1.0"
 
 [features]
diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml
index 52ea1d8d6..65223caab 100644
--- a/crates/wasmtime/Cargo.toml
+++ b/crates/wasmtime/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "High-level API to expose the Wasmtime runtime"
 documentation = "https://docs.rs/wasmtime"
@@ -13,14 +13,14 @@ edition = "2021"
 rustdoc-args = ["--cfg", "nightlydoc"]
 
 [dependencies]
-wasmtime-runtime = { path = "../runtime", version = "=0.40.0" }
-wasmtime-environ = { path = "../environ", version = "=0.40.0" }
-wasmtime-jit = { path = "../jit", version = "=0.40.0" }
-wasmtime-cache = { path = "../cache", version = "=0.40.0", optional = true }
-wasmtime-fiber = { path = "../fiber", version = "=0.40.0", optional = true }
-wasmtime-cranelift = { path = "../cranelift", version = "=0.40.0", optional = true }
-wasmtime-component-macro = { path = "../component-macro", version = "=0.40.0", optional = true }
-wasmtime-component-util = { path = "../component-util", version = "=0.40.0", optional = true }
+wasmtime-runtime = { path = "../runtime", version = "=0.41.0" }
+wasmtime-environ = { path = "../environ", version = "=0.41.0" }
+wasmtime-jit = { path = "../jit", version = "=0.41.0" }
+wasmtime-cache = { path = "../cache", version = "=0.41.0", optional = true }
+wasmtime-fiber = { path = "../fiber", version = "=0.41.0", optional = true }
+wasmtime-cranelift = { path = "../cranelift", version = "=0.41.0", optional = true }
+wasmtime-component-macro = { path = "../component-macro", version = "=0.41.0", optional = true }
+wasmtime-component-util = { path = "../component-util", version = "=0.41.0", optional = true }
 target-lexicon = { version = "0.12.0", default-features = false }
 wasmparser = "0.88.0"
 anyhow = "1.0.19"
diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml
index e093d47fb..ac71e4ccc 100644
--- a/crates/wast/Cargo.toml
+++ b/crates/wast/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmtime-wast"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["The Wasmtime Project Developers"]
 description = "wast testing support for wasmtime"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -11,7 +11,7 @@ edition = "2021"
 
 [dependencies]
 anyhow = "1.0.19"
-wasmtime = { path = "../wasmtime", version = "0.40.0", default-features = false, features = ['cranelift'] }
+wasmtime = { path = "../wasmtime", version = "0.41.0", default-features = false, features = ['cranelift'] }
 wast = "45.0.0"
 log = "0.4"
 
diff --git a/crates/wiggle/Cargo.toml b/crates/wiggle/Cargo.toml
index bcb699c15..84120afd9 100644
--- a/crates/wiggle/Cargo.toml
+++ b/crates/wiggle/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wiggle"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkonk@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
 edition = "2021"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -13,11 +13,11 @@ include = ["src/**/*", "README.md", "LICENSE"]
 [dependencies]
 thiserror = "1"
 witx = { path = "../wasi-common/WASI/tools/witx", version = "0.9.1", optional = true }
-wiggle-macro = { path = "macro", version = "=0.40.0" }
+wiggle-macro = { path = "macro", version = "=0.41.0" }
 tracing = "0.1.26"
 bitflags = "1.2"
 async-trait = "0.1.42"
-wasmtime = { path = "../wasmtime", version = "0.40.0", optional = true, default-features = false }
+wasmtime = { path = "../wasmtime", version = "0.41.0", optional = true, default-features = false }
 anyhow = "1.0"
 
 [badges]
diff --git a/crates/wiggle/generate/Cargo.toml b/crates/wiggle/generate/Cargo.toml
index af3ac56af..82aad975a 100644
--- a/crates/wiggle/generate/Cargo.toml
+++ b/crates/wiggle/generate/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wiggle-generate"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
 license = "Apache-2.0 WITH LLVM-exception"
 edition = "2021"
diff --git a/crates/wiggle/macro/Cargo.toml b/crates/wiggle/macro/Cargo.toml
index f2b6df1d6..ef54e2221 100644
--- a/crates/wiggle/macro/Cargo.toml
+++ b/crates/wiggle/macro/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wiggle-macro"
-version = "0.40.0"
+version = "0.41.0"
 authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
 edition = "2021"
 license = "Apache-2.0 WITH LLVM-exception"
@@ -21,7 +21,7 @@ test = false
 doctest = false
 
 [dependencies]
-wiggle-generate = { path = "../generate", version = "=0.40.0" }
+wiggle-generate = { path = "../generate", version = "=0.41.0" }
 quote = "1.0"
 syn = { version = "1.0", features = ["full"] }
 proc-macro2 = "1.0"


Test patch:
diff --git a/cranelift/filetests/Cargo.toml b/cranelift/filetests/Cargo.toml
index 7f87f195e..47a2b49c5 100644
--- a/cranelift/filetests/Cargo.toml
+++ b/cranelift/filetests/Cargo.toml
@@ -10,12 +10,12 @@ publish = false
 edition = "2021"
 
 [dependencies]
-cranelift-codegen = { path = "../codegen", version = "0.87.0", features = ["testing_hooks"] }
-cranelift-frontend = { path = "../frontend", version = "0.87.0" }
-cranelift-interpreter = { path = "../interpreter", version = "0.87.0" }
-cranelift-native = { path = "../native", version = "0.87.0" }
-cranelift-reader = { path = "../reader", version = "0.87.0" }
-cranelift-preopt = { path = "../preopt", version = "0.87.0" }
+cranelift-codegen = { path = "../codegen", version = "0.88.0", features = ["testing_hooks"] }
+cranelift-frontend = { path = "../frontend", version = "0.88.0" }
+cranelift-interpreter = { path = "../interpreter", version = "0.88.0" }
+cranelift-native = { path = "../native", version = "0.88.0" }
+cranelift-reader = { path = "../reader", version = "0.88.0" }
+cranelift-preopt = { path = "../preopt", version = "0.88.0" }
 file-per-thread-logger = "0.1.2"
 filecheck = "0.5.0"
 gimli = { version = "0.26.0", default-features = false, features = ["read"] }
diff --git a/crates/test-programs/Cargo.toml b/crates/test-programs/Cargo.toml
index b292ef936..4be94cb84 100644
--- a/crates/test-programs/Cargo.toml
+++ b/crates/test-programs/Cargo.toml
@@ -11,10 +11,10 @@ license = "Apache-2.0 WITH LLVM-exception"
 cfg-if = "1.0"
 
 [dev-dependencies]
-wasi-common = { path = "../wasi-common", version = "0.40.0" }
-wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "0.40.0" }
-wasmtime = { path = "../wasmtime", version = "0.40.0" }
-wasmtime-wasi = { path = "../wasi", version = "0.40.0", features = ["tokio"] }
+wasi-common = { path = "../wasi-common", version = "0.41.0" }
+wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "0.41.0" }
+wasmtime = { path = "../wasmtime", version = "0.41.0" }
+wasmtime-wasi = { path = "../wasi", version = "0.41.0", features = ["tokio"] }
 target-lexicon = "0.12.0"
 pretty_env_logger = "0.4.0"
 tempfile = "3.1.0"
diff --git a/tests/misc_testsuite/component-model/fused.wast b/tests/misc_testsuite/component-model/fused.wast
index 6d326da6e..6de762471 100644
--- a/tests/misc_testsuite/component-model/fused.wast
+++ b/tests/misc_testsuite/component-model/fused.wast
@@ -1393,3 +1393,44 @@
   )
   (instance (instantiate $c2 (with "" (instance $c1))))
 )
+
+;; Adapters are used slightly out-of-order here to stress the internals of
+;; dependencies between adapters.
+(component
+  (core module $m
+    (func (export "execute"))
+    (func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable)
+    (memory (export "memory") 1)
+  )
+
+  (component $root
+    (core instance $m (instantiate $m))
+    (func (export "execute")
+      (canon lift (core func $m "execute"))
+    )
+  )
+  (component $c
+    (import "backend" (instance $i
+      (export "execute" (func))
+    ))
+    (core module $shim2 (import "" "0" (func)))
+    (core instance $m (instantiate $m))
+
+    ;; This adapter, when fused with itself on the second instantiation of this
+    ;; component, will dependend on the prior instance `$m` so it which means
+    ;; that the adapter module containing this must be placed in the right
+    ;; location.
+    (core func $execute
+      (canon lower (func $i "execute") (memory $m "memory") (realloc (func $m "realloc")))
+    )
+    (core instance (instantiate $shim2
+      (with "" (instance
+        (export "0" (func $execute))
+      ))
+    ))
+    (func (export "execute") (canon lift (core func $m "execute")))
+  )
+  (instance $root (instantiate $root))
+  (instance $c1 (instantiate $c (with "backend" (instance $root))))
+  (instance $c2 (instantiate $c (with "backend" (instance $c1))))
+)